diff --git a/vendor/refinerycms/core/app/views/shared/_menu.html.erb b/vendor/refinerycms/core/app/views/shared/_menu.html.erb index 18d65d17b0..85d950a3d4 100644 --- a/vendor/refinerycms/core/app/views/shared/_menu.html.erb +++ b/vendor/refinerycms/core/app/views/shared/_menu.html.erb @@ -3,14 +3,19 @@ css ||= 'menu' hide_children = RefinerySetting.find_or_set(:menu_hide_children, false) unless defined?(hide_children) cache_key = [Refinery.base_cache_key] + cache_key << dom_id cache_key << (action_suffix ||= RefinerySetting.find_or_set(:refinery_menu_cache_action_suffix, "site_menu")) - cache_key << extra_suffix if defined?(extra_suffix) and extra_suffix.present? cache_key << request.path - cache(cache_key.compact.join('_')) do - # Select top menu items unless 'roots' is passed in. + cache_if(RefinerySetting.find_or_set(:menu_cache_enabled, true), cache_key.compact.join('_')) do + # Select top menu items unless 'roots' is supplied. collection ||= @menu_pages - roots ||= collection.select { |m| m.parent_id == nil } - if roots.any? + # In order to match items that aren't shown in menu and highlight their associations. + # This can be supplied if the logic different in your case. + unless defined?(selected_item) + selected_item = collection.detect{|page| selected_page?(page)} + selected_item = @page if selected_item.nil? + end + if (roots ||= collection.select { |m| m.parent_id.nil? }).any? sibling_count = roots.size - 1 -%>