Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge remote branch 'moretea/sweepers'

  • Loading branch information...
commit ea58c03270fa3c3342e2392a0058e4dd0e68966d 2 parents 177a78f + 6b5f2e0
@parndt parndt authored
View
7 vendor/refinerycms/core/app/views/shared/_menu.html.erb
@@ -6,13 +6,14 @@
cache_key << RefinerySetting.find_or_set(:refinery_menu_cache_action_suffix, "site_menu")
cache_key << request.path
cache(cache_key.join('_')) do
- if (collection ||= @menu_pages).any?
- sibling_count = collection.size - 1
+ roots = @menu_pages.select { |m| m.parent_id == nil } # Select top menu items
+ if roots.any?
+ sibling_count = roots.size - 1
-%>
<nav id='<%= dom_id %>' class='<%= %W(#{css} clearfix).join(' ') %>'>
<ul>
<%= render :partial => "/shared/menu_branch",
- :collection => collection,
+ :collection => roots,
:locals => {
:hide_children => hide_children,
:sibling_count => sibling_count,
View
5 vendor/refinerycms/core/app/views/shared/_menu_branch.html.erb
@@ -4,12 +4,13 @@
" class='#{classes.join(' ')}'"
end
dom_id = (" id='item_#{menu_branch_counter}'" if menu_branch.parent_id.nil? and menu_branch.title.present?)
+ @menu_pages.reject! { |branch| branch == menu_branch } # Remove page from the array, so that future searching will be faster.
+ children = @menu_pages.select { |p| p.parent_id == menu_branch.id && p.in_menu? }
-%>
<li<%= css -%><%= dom_id -%>>
<%= link_to menu_branch.title, menu_branch.url %>
- <% unless hide_children or
- (children = menu_branch.children.reject{|c| !c.in_menu?}).empty? %>
+ <% unless hide_children or children.empty? %>
<ul class='clearfix'>
<%=
render :partial => "/shared/menu_branch",
View
2  vendor/refinerycms/core/lib/refinery/application_controller.rb
@@ -79,7 +79,7 @@ def login?
# get all the pages to be displayed in the site menu.
def find_pages_for_menu
- @menu_pages = Page.top_level
+ @menu_pages = Page.order('lft ASC')
end
# use a different model for the meta information.
Please sign in to comment.
Something went wrong with that request. Please try again.