allow plugins to modify the navigation menu

This commit is contained in:
wvengen 2013-10-29 21:47:36 +01:00
parent 7779c15dc9
commit fde7904c1a

View file

@ -3,6 +3,11 @@
SimpleNavigation::Configuration.run do |navigation|
# allow engines to add to the menu - https://gist.github.com/mjtko/4873ee0c112b6bd646f8
engines = Rails.application.railties.engines.select { |e| e.respond_to?(:navigation) }
# to include an engine but keep it from modifying the menu:
#engines.reject! { |e| e.instance_of? FoodsoftMyplugin::Engine }
navigation.items do |primary|
primary.dom_class = 'nav'
@ -47,6 +52,8 @@ SimpleNavigation::Configuration.run do |navigation|
subnav.item :ordergroups, I18n.t('navigation.admin.ordergroups'), admin_ordergroups_path, id: nil
subnav.item :workgroups, I18n.t('navigation.admin.workgroups'), admin_workgroups_path, id: nil
end
engines.each { |e| e.navigation(primary, self) }
end
end