This plugin provides a simplest way to add tabs controls in your apps.
I took the idea from here and implemented it as a Rails plugin.
First of all, your app’s header has to include the jquery file. Something like this:
<%= javascript_include_tag "jquery" %>
Second, install plugin and run rake task
script/plugin install git://github.com/undr/tabulator.git
rake tabulator:install
Run rake task
rake tabulator:remove
and remove folder with plugin
<% content_for :head do %>
<%= tabulator_init %>
<% end %>
<% tabulator do |t| %>
<% t.tab(:tab_id1, "Tab title #1") do -%>
Some content for tab #1
<% end -%>
<% t.tab(:tab_id2, "Tab title #2", true) do -%> # An active tab
Some content for tab #2
<% end -%>
<% end %>
<% tabulator do |t| %>
<% t.tab(:tab_id3, "Tab title #1", render(:partial => "some_template", :locals => {:number => 5})) -%>
<% t.tab(:tab_id4, "Tab title #2", render(:partial => "some_template"), true) -%> # An active tab
<% t.status("Some status text") %>
<% end %>
<% tabulator(:partial => "my_own_tabs_template", :height => "400px") do |t| %>
<% t.tab(:tab_id5, "Tab title #1", "Some content for tab #1" -%>
<% t.tab(:tab_id6, "Tab title #2", "Some content for tab #1", true) -%> # An active tab
<% t.status("Some status text") %>
<% end %>
Copyright © 2010 undr, released under the MIT license