Active Navigation Item Name

andi edited this page Dec 27, 2010 · 3 revisions

In addition to render_navigation there is another helper method called active_navigation_item_name to just render the name of the currently active navigation item. This can be useful for example if you have a sidebar and the heading of the sidebar is always equal to the currently active secondary navigation. To achieve this you would call the helper method like this (using haml):

.sidebar
  %h1= active_navigation_item_name(:level => 2)

You can pass the following options to active_navigation_item_name:

  • :level – this option determines for which level you want to render the name of the currently active navigation item. Use :level => :all to render the name of the most specific/deepest item possible. Use a specific level (e.g. :level => 1) to always render the active item name of the same level. Defaults to :all.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.