Skip to content

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.

License

Notifications You must be signed in to change notification settings

mghaught/yui4rails

Repository files navigation

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

About

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.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published