codeplant/simple-navigation

Is there a way to have a class *around* an ul, li item?

Rubytastic2 opened this issue · 1 comments

I would like to add a ul around some li items.
This is required to have a bootstrap nav thats pulled right.

For example within the existing UL LI list I would like something like this to be outputted:

<ul class="nav navbar-nav navbar-right">
<li class="dropdown"> </li>
<li class="account">
<a href="/employee/account">Account </a>
</li>
</ul>

My current navigation is like so:

SimpleNavigation::Configuration.run do |navigation|

  navigation.items do |primary|

    primary.dom_class         = 'nav navbar-nav'
    navigation.selected_class = 'active'

   # this fails see my other question, because no access to current_employee which is a 
   # devise helper same as current_user from devise
    unless current_employee.employee_profile.completed
      @class = "disabled"
    end

    primary.item :dashboard, "Dashboard", conditional_navigation(root_path),
                 :html => {:class => @class},
                 :highlights_on => lambda { ["employee/dashboard"].member?(params[:controller]) }

    primary.item :profile, "Mijn profiel", conditional_navigation(employee_profile_edit_path),
                 :html => {:class => @class},
                 :highlights_on => lambda { params[:controller].include?("profile") }

   # add the account menu item here with the ul html around it

  end
end
andi commented

If you really need different HTML code output, you might consider writing your own renderer. Also you can check out https://github.com/ShPakvel/simple_navigation_renderers, not sure how well maintained this is, but at least it will give you some starting point...