make messages plugin work with custom navigation menu
This commit is contained in:
parent
d7938b752c
commit
89f4a18b24
1 changed files with 7 additions and 4 deletions
|
@ -1,11 +1,14 @@
|
|||
module FoodsoftMessages
|
||||
class Engine < ::Rails::Engine
|
||||
def navigation(primary, context)
|
||||
item = SimpleNavigation::Item.new(primary, :messages, I18n.t('navigation.messages'), context.messages_path)
|
||||
return if primary[:foodcoop].nil?
|
||||
sub_nav = primary[:foodcoop].sub_navigation
|
||||
# display right before tasks item
|
||||
tasks_index = sub_nav.items.index(sub_nav[:tasks])
|
||||
sub_nav.items.insert(tasks_index, item)
|
||||
sub_nav.items <<
|
||||
SimpleNavigation::Item.new(primary, :messages, I18n.t('navigation.messages'), context.messages_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
|
||||
|
|
Loading…
Reference in a new issue