allow plugins to modify the navigation menu
This commit is contained in:
parent
7779c15dc9
commit
fde7904c1a
1 changed files with 7 additions and 0 deletions
|
@ -3,6 +3,11 @@
|
||||||
|
|
||||||
SimpleNavigation::Configuration.run do |navigation|
|
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|
|
navigation.items do |primary|
|
||||||
primary.dom_class = 'nav'
|
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 :ordergroups, I18n.t('navigation.admin.ordergroups'), admin_ordergroups_path, id: nil
|
||||||
subnav.item :workgroups, I18n.t('navigation.admin.workgroups'), admin_workgroups_path, id: nil
|
subnav.item :workgroups, I18n.t('navigation.admin.workgroups'), admin_workgroups_path, id: nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
engines.each { |e| e.navigation(primary, self) }
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue