资源说明: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.The above will generate this HTML in your view:<% tabs_for do |tab| %> <% tab.create('tab_one', 'Tab 1') do %> # ... insert tab contents <% end %> <% tab.create('tab_two', 'Tab 2') do %> # ... insert tab contents <% end %> <% end %>
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 ...
You can pass HTML options to either the parent DIV or any individual tab's DIV as you like ...<% tab.create('profile_tab', 'Your Profile') do %> # ... insert tab contents <% end unless @current_user.nil? %>
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.<% tabs_for(:class => 'zippy') do |tab| %> <% tab.create('tab_one', 'Tab 1', :style => 'background: #FFF') do %> # ... insert tab contents <% end %> <% end %>
<% accordions_for do |accordion| %> <% accordion.create("dom_id", "accordion_title") do %> # ... insert accordion contents <% end %> <% end %>
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。