Hi folks, am pretty new to RoR and programming (2 weeks in!), and am using this gem to generate a menu structure in an admin namespace.
We have 3 or 4 levels of nested menu, depending on options chosen.
Heres a chunk of the layout:
<%= render_navigation( :context => :admin, :level => 1) %>
<!--! and :admintop-->
<%= render_navigation( :context => :admin, :level => 2) %>
<!--! This row is for the yield of menu items! -->
<div class="row subnavonly">
<%= render_navigation( :context => :admin, :level => 3) %>
<div class="row content">
<%= yield %>
I need to render a different width row, containing the yield dependent on the existence of level 3 (and sometimes 4th) menus.
Ideally I would like to adjust / set the class of '.content div' between span10 and span12 accordingly.
I need to make sure I dont render the divs around the 3rd level when its empty.
I think my choices are:
Work out how to dynamically include the <div class="row"><div class="span2"> and matching closing tags around the outside of the ul that the third level would generate -- and if its missing not render them at all.
Work out how to test for the existence of 3rd level items and load a differnet partial containing a different output in each case (with/without lvl 3)
Find a way to insert a partial containing the sub_sub_nav inside the yield (content_for ?), and only render it if used - I will have different controllers and many different yields however.
I should probably also note - that as soon as I learn how I want to change all the links to be ajaxified using remote => true (I mention in case it impacts on the 'best' solution)
The content rendered in yield may itself have links and actions that need to stay rendered within that yield and not break out (unsure if that is relevant)
Am I missing anything obvious, and how should I approach it ?
Many thanks for a great gem!