public
Description: a Ruby on Rails plugin for easier integration of the YUI library into a Ruby on Rails application. It will include helpers for generating widgets and including the YUI file dependencies.
Homepage: http://rubyforge.org/projects/yui4rails/
Clone URL: git://github.com/mghaught/yui4rails.git
mghaught (author)
Mon Nov 24 09:46:41 -0800 2008
commit  274306eb2d77fc761730e418a9443440bfd5d7af
tree    2bc39998491d219e599bd6e524677682b7e4bb72
parent  927a5ec7f2ce36a5238e252c4d6c5bcd12efd190
name age message
file .gitignore Thu Apr 17 10:08:39 -0700 2008 Added .gitignore file to freshly pulled svn rep... [mghaught]
file CHANGELOG Loading commit data...
file CONTRIBUTORS
file MIT-LICENSE
file README Sat Jul 19 19:49:35 -0700 2008 correcting readme include_yui -> yui_includes [Jim Hughes]
file Rakefile Tue May 13 19:53:51 -0700 2008 Cleaned up crufty rake tasks. Removed rcov par... [mghaught]
file init.rb
file install.rb Fri Feb 08 15:18:20 -0800 2008 Initial check-in of YUI4Rails plugin for YUI re... [mghaught]
directory lib/ Mon Nov 24 09:46:41 -0800 2008 Merged chart changes into smc application [mghaught]
directory public/
directory spec/ Mon Nov 24 09:46:41 -0800 2008 Merged chart changes into smc application [mghaught]
directory tasks/
file uninstall.rb
YUI 4 Rails
===========

YUI 4 Rails is a plugin for easier integration of YUI components/widgets into a Rails application.  Initially, we will 
only be offering two components, datatable and charts, however more will follow.  We also encourage others to help 
convert their favorite components for the plugin and contribute it back to the community.  


Installation
===========

As with plugins, you can install YUI 4 Rails either from archive or subversion.

Via Subversion:


script/plugin install svn://rubyforge.org/var/svn/yui4rails/tags/yui4rails-0.1.1

Via archive:

Download either the tar.gz or zip file and extract it into your RAILS_APP/vendor/plugins directory. 

For those of you wishing to be more on the cutting edge of the plugin, please use my github repo at:

http://github.com/mghaught/yui4rails/tree/master

You can install it via the git clone command (if you have Git installed):

git clone git://github.com/mghaught/yui4rails vendor/plugins/yui4rails

Or hit the download button and extract the tarball as the archive command above illustrates.

Next, you will want to run the rake command to install the YUI resources into your application.  

From the plugin root, run this command:
rake yui4rails:update

If you're running off trunk or a version newer than 0.1.1 then you can do this instead:

rake yui4rails:update

You should then find a lot of resources copied to the <RAILS_ROOT>/public/yui directory.  At this time, the plugin 
assumes that you are referencing the YUI resources from your server, as opposed to theirs.  We will make this optional 
in the future.

At this point you can start to use the plugin in your application.


Using
===========

1) Including YUI resources

We have a convenience include helper for you to use in your templates

<%= yui_includes  %>

You will want to feed this an array of component names (as symbols) such as:

<%= yui_includes :datatable, :charts %>

It will pull in the necessary javascript and stylesheet resources for those components.


For the two components, you'll first want to read up on how to use them from YUI's developer site as they're not trivial 
widgets.  Our wrappers on these objects are as follows:

data_table = Yui4Rails::Widgets::DataTable.new("your_table_id", column_definitions, data_rows, footer_row = "")

After constructing the component, you then need to render it via the render method:

data_table.render

Charts works essentially the same way:

chart = Yui4Rails::Widgets::Chart.new("yui_chart_id", yui_column_definitions, yui_data_rows)
chart.render


You can usually find more tidbits on this plugin at Marty Haught's blog:  http://martyhaught.com

Copyright (c) 2008 Marty Haught, Andy Kappen, released under the MIT license