jquery-ui-rails-helpers icon indicating copy to clipboard operation
jquery-ui-rails-helpers copied to clipboard

JQuery UI helpers you can use in your Rails apps

h1. What Is It?

These are some view helpers I use in Rails to better integrate jQuery UI into my sites.

I hope you find them useful.

h2. TabsHelper

This helper simplifies the code required to use the jQuery UI Tab plugin.



	
		# ... insert tab contents
	
	
		# ... insert tab contents
	

The above will generate this HTML in your view:


  • Tab 1
  • Tab 2
# ... insert tab contents
# ... insert tab contents

Tabs will be rendered in the order you create them.

You can easily render a tab conditionally by appending your condition to the end of the 'create' block as such ...



	# ... insert tab contents

You can pass HTML options to either the parent DIV or any individual tab's DIV as you like ...


 'zippy') do |tab| %>
	 'background: #FFF') do %>
		# ... insert tab contents
	

The default DOM ID for the parent div is ... id="tabs" ... unless you pass in an HTML option with a different value.

h2. AccordionsHelper

This helper simplifies the code required to use JQuery UIs Accordion plugin.

Usage is identical to the Tabs helper.



	
		# ... insert accordion contents