weppos / tabs_on_rails

Tabs on Rails is a simple Rails plugin for creating and managing tabs and navigation menus.
https://simonecarletti.com/code/tabs-on-rails
MIT License
294 stars 52 forks source link

Display a different set of "sub-tabs" populated by controller. #21

Closed voltechs closed 12 years ago

voltechs commented 12 years ago

My different main sections have the need for unique sub-navigation. I'd like to be able to define the array/hash for the subnav in the appropriate controller and have the layout render them. How could I do that?

weppos commented 12 years ago

Check out the documentation for namespaces.

voltechs commented 12 years ago

Hey weppos. Thanks for addressing this issue.

Either I don't understand the documentation, or you didn't quite understand my issue.

What I'm attempting to accomplish is displaying a unique sub navigation with respect to the current controller. From what I understand from reading and re-reading the documentation and searching extensively online for tutorials and whatnot, is that the only thing I could do is create another un-changing sub navigation that I could through namespacing, specify which tab to display as active.

This of course leaves me still with a mostly static sub-navigation, resulting in irrelevant links on inappropriate pages.

How could I display one set of sub-tabs on say, my groups_controller, and another on my projects_controller?

Keep in mind my navigation is rendered in the application.html.erb layout. The way my layout is configured, it does not suite me to place particular tab-drawing/rendering anywhere other than the layout.

Please advise! :)

weppos commented 12 years ago

Use an If/else to conditionally display only the tabs according to your controller.