foodsoft/plugins/polls/lib/foodsoft_polls/engine.rb
Patrick Gansterer d476993321 Add polls plugin
2020-02-24 14:27:22 +01:00

15 lines
526 B
Ruby

module FoodsoftPolls
class Engine < ::Rails::Engine
def navigation(primary, context)
return unless FoodsoftPolls.enabled?
return if primary[:foodcoop].nil?
sub_nav = primary[:foodcoop].sub_navigation
sub_nav.items <<
SimpleNavigation::Item.new(primary, :polls, I18n.t('navigation.polls'), context.polls_path)
# move to right before tasks item
if i = sub_nav.items.index(sub_nav[:tasks])
sub_nav.items.insert(i, sub_nav.items.delete_at(-1))
end
end
end
end