-
Notifications
You must be signed in to change notification settings - Fork 37
Tabnav
paolodona edited this page Sep 12, 2010
·
18 revisions
The Tabnav widgets generates tabbed navigations. It can create horizontal, vertical, nested tabbed navigations.. and you can style it the way you want using CSS hooks.
It provides an easy way to pass highlighting rules and disable tabs at runtime ad well.
Let’s generate a main tabbed navigation for our site (I’ll call it main, you can call it what you want)
$ script/generate tabnav main
create app/views/widgets
create app/views/widgets/_main_tabnav.rhtml
It creates a partial with the tabnav definition.
Now we can insert the tabnav wherever we want, I’ll put it in my app/views/layouts/application.html.erb.
...
<% tabnav :main do%>
<%= yield %>
<% end %>
...
Now reload your pages, you should see a Tabbed navigation and one tab for each controller. Now you can edit the app/views/widgets/_main_tabnav.rhtml partial.