Skip to content

Commit

Permalink
Allow css to be disabled on the menu for those who don't need it and …
Browse files Browse the repository at this point in the history
…want the increased speed without all the lookups.
  • Loading branch information
parndt committed Sep 6, 2010
1 parent d24ff1d commit 69cd6f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion vendor/refinerycms/core/app/views/shared/_menu.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
:collection => collection,
:locals => {
:hide_children => hide_children ||= RefinerySetting.find_or_set(:menu_hide_children, false),
:sibling_count => sibling_count
:sibling_count => sibling_count,
:apply_css => true #if you don't care about class='first' class='last' or class='selected' set apply_css to false for speed.
}
-%>
</ul>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<%
css = (css = css_for_menu_branch(menu_branch, menu_branch_counter, sibling_count||=nil)).any? ? " class='#{css.join(' ')}'" : nil
css = if ((defined?(apply_css) && apply_css) || !defined?(apply_css)) and
(classes = css_for_menu_branch(menu_branch, menu_branch_counter, sibling_count||=nil.any?))
" class='#{classes.join(' ')}'"
end
dom_id = (menu_branch.parent_id.nil? and menu_branch.title.present?) ? " id='item_#{menu_branch_counter}'" : nil
-%>
<li<%= css -%><%= dom_id -%>>
Expand All @@ -12,7 +15,7 @@
render :partial => "/shared/menu_branch",
:collection => children,
:locals => {
:hide_children => hide_children,
:hide_children => false, # hide children can't be true or we wouldn't get here.
:sibling_count => children.size - 1
} -%>
</ul>
Expand Down

0 comments on commit 69cd6f0

Please sign in to comment.