Add messagegroup

Messagegroups are a new kind of group. Every user can join and leave such a
group on her own. They are useful to create topics for mails.

E.g. if there is a weekly newsletter we can create a new messagegroup for
it and every user which is interested in receiving the newsletter can join
the corresponding group.
This commit is contained in:
Patrick Gansterer 2016-02-17 12:26:21 +01:00 committed by wvengen
parent b30b4e46d8
commit 01cf6431a9
15 changed files with 172 additions and 9 deletions

View file

@ -2,13 +2,25 @@ module FoodsoftMessages
class Engine < ::Rails::Engine
def navigation(primary, context)
return unless FoodsoftMessages.enabled?
return if primary[:foodcoop].nil?
sub_nav = primary[:foodcoop].sub_navigation
sub_nav.items <<
SimpleNavigation::Item.new(primary, :message_threads, I18n.t('navigation.messages'), context.message_threads_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))
unless primary[:foodcoop].nil?
sub_nav = primary[:foodcoop].sub_navigation
sub_nav.items <<
SimpleNavigation::Item.new(primary, :messagegroups, I18n.t('navigation.messagegroups'), context.messagegroups_path)
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
unless 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
if i = sub_nav.items.index(sub_nav[:config])
sub_nav.items.insert(i, sub_nav.items.delete_at(-1))
end
end
end