-
Notifications
You must be signed in to change notification settings - Fork 37
Navigation
paolodona edited this page Sep 12, 2010
·
8 revisions
The Navigation widgets works pretty much like the Tabnav but generates navigation links instead of tabs.
Let’s generate a main tabbed navigation for our site (I’ll call it main, you can call it what you want)
$ script/generate navigation main
create app/views/widgets
create app/views/widgets/_main_navigation.html.erb
It creates a partial with the navigation definition.
Now we can insert the navigation wherever we want, I’ll put it in my app/views/layouts/application.html.erb.
...
<%= navigation :main %>
<%= yield %>
...
Reload your pages, you should see top right navigation links.
Now you can edit the app/views/widgets/_main_navigation.html.erb partial:
...
add_item do |i
i.named "home"
i.links_to :controller => "invoices"
end
...
add_item :link => "http://www.seesaw.it"