2014-03-07 09:51:24 +01:00
|
|
|
module FoodsoftMessages
|
|
|
|
class Engine < ::Rails::Engine
|
|
|
|
def navigation(primary, context)
|
2014-04-05 18:47:16 +02:00
|
|
|
return unless FoodsoftMessages.enabled?
|
2021-03-01 15:27:26 +01:00
|
|
|
|
2016-02-17 12:26:21 +01:00
|
|
|
unless primary[:foodcoop].nil?
|
|
|
|
sub_nav = primary[:foodcoop].sub_navigation
|
|
|
|
sub_nav.items <<
|
2016-03-04 14:26:56 +01:00
|
|
|
SimpleNavigation::Item.new(primary, :messages, I18n.t('navigation.messages'), context.message_threads_path)
|
2016-02-17 12:26:21 +01:00
|
|
|
# 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
|
2023-05-12 13:01:12 +02:00
|
|
|
return if primary[:admin].nil?
|
|
|
|
|
|
|
|
sub_nav = primary[:admin].sub_navigation
|
|
|
|
sub_nav.items <<
|
|
|
|
SimpleNavigation::Item.new(primary, :messagegroups, I18n.t('navigation.admin.messagegroups'),
|
|
|
|
context.admin_messagegroups_path)
|
|
|
|
# move to right before config item
|
|
|
|
return unless i = sub_nav.items.index(sub_nav[:config])
|
|
|
|
|
|
|
|
sub_nav.items.insert(i, sub_nav.items.delete_at(-1))
|
2014-03-07 09:51:24 +01:00
|
|
|
end
|
2014-06-23 10:10:21 +02:00
|
|
|
|
|
|
|
def default_foodsoft_config(cfg)
|
|
|
|
cfg[:use_messages] = true
|
|
|
|
end
|
2014-03-07 09:51:24 +01:00
|
|
|
end
|
|
|
|
end
|