Permalink
Browse files

add more flexibility so that the menu could be used as a submenu or a…

… footer menu or anywhere you want, just add in an extra suffix and specify the roots as locals
  • Loading branch information...
1 parent 78d0e87 commit 072853d454d71ac9aa7a2906bc3e706a552a578a @parndt parndt committed Sep 16, 2010
Showing with 5 additions and 3 deletions.
  1. +5 −3 vendor/refinerycms/core/app/views/shared/_menu.html.erb
@@ -3,10 +3,12 @@
css ||= 'menu'
hide_children = RefinerySetting.find_or_set(:menu_hide_children, false) unless defined?(hide_children)
cache_key = [Refinery.base_cache_key]
- cache_key << RefinerySetting.find_or_set(:refinery_menu_cache_action_suffix, "site_menu")
+ 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.join('_')) do
- roots = @menu_pages.select { |m| m.parent_id == nil } # Select top menu items
+ cache(cache_key.compact.join('_')) do
+ # Select top menu items unless 'roots' is passed in.
+ roots ||= @menu_pages.select { |m| m.parent_id == nil }
if roots.any?
sibling_count = roots.size - 1
-%>

0 comments on commit 072853d

Please sign in to comment.