-
-
Save parndt/507472 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% | |
css = [] | |
css << "selected" if selected_page?(menu_branch) or descendant_page_selected?(menu_branch) | |
css << "first" if menu_branch_counter == 0 | |
css << "last" if menu_branch_counter == (sibling_count ||= menu_branch.shown_siblings.size) | |
domid = "item_#{menu_branch_counter}" unless menu_branch.parent_id.present? or menu_branch.title.blank? | |
-%> | |
<% if menu_branch.in_menu? %> | |
<li<%= " class='#{css.join(' ')}'" if css.present? -%><%= " id='#{domid}'" if domid.present? -%>> | |
<%= link_to menu_branch.title, menu_branch.url %> | |
<% | |
unless hide_children or | |
menu_branch.parent_id.present? or | |
(children = menu_branch.children.collect{|c| c if c.in_menu?}.compact).empty? | |
-%> | |
<% if css.include?("selected") %> | |
<ul class='clearfix keepon'> | |
<%= render :partial => "/shared/menu_branch", | |
:collection => children, | |
:locals => {:hide_children => hide_children, :sibling_count => children.size-1} -%> | |
</ul> | |
<% end %> | |
<% end -%> | |
</li> | |
<% end -%> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment