Skip to content
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. It provides an easy way to pass highlighting rules and disable tabs at runtime.

How to generate a Tabnav

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 %>

Clone this wiki locally