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)
Fri Nov 21 15:36:27 -0800 2008
commit  927a5ec7f2ce36a5238e252c4d6c5bcd12efd190
tree    6363f75f9eecde2bfdd10f6352268b818d3d4159
parent  a0198b2d558bc5a84d5cf981e1f88988c0c64fdc
name age message
file .gitignore Thu Apr 17 10:08:39 -0700 2008 Added .gitignore file to freshly pulled svn rep... [mghaught]
file CHANGELOG Fri Apr 18 15:56:09 -0700 2008 Added CHANGELOG and CONTRIBUTORS files for the ... [mghaught]
file CONTRIBUTORS Fri Apr 18 15:56:09 -0700 2008 Added CHANGELOG and CONTRIBUTORS files for the ... [mghaught]
file MIT-LICENSE Fri Feb 08 15:18:20 -0800 2008 Initial check-in of YUI4Rails plugin for YUI re... [mghaught]
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 Fri Feb 08 15:18:20 -0800 2008 Initial check-in of YUI4Rails plugin for YUI re... [mghaught]
file install.rb Fri Feb 08 15:18:20 -0800 2008 Initial check-in of YUI4Rails plugin for YUI re... [mghaught]
directory lib/ Loading commit data...
directory public/ Fri Oct 31 11:14:42 -0700 2008 Added YUI 2.6 resource files [mghaught]
directory spec/ Sat Jul 19 21:13:46 -0700 2008 extra config options for datatable [Jim Hughes]
directory tasks/ Tue May 13 19:53:51 -0700 2008 Cleaned up crufty rake tasks. Removed rcov par... [mghaught]
file uninstall.rb Fri Feb 08 15:18:20 -0800 2008 Initial check-in of YUI4Rails plugin for YUI re... [mghaught]
README
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