From 179f442a87840b7328088ba40776cfa8107b9f57 Mon Sep 17 00:00:00 2001 From: wvengen Date: Fri, 4 Mar 2016 14:26:56 +0100 Subject: [PATCH] Small message group improvements --- .../add_messages_prefs.html.haml.deface | 7 ++- .../views/admin/messagegroups/index.html.haml | 1 + .../app/views/message_threads/index.html.haml | 4 +- .../app/views/messagegroups/index.html.haml | 2 +- .../app/views/messages/_actionbar.haml | 8 ++++ .../app/views/messages/index.html.haml | 5 +- plugins/messages/config/locales/de.yml | 10 +++- plugins/messages/config/locales/en.yml | 48 +++++++++++-------- .../messages/lib/foodsoft_messages/engine.rb | 4 +- 9 files changed, 55 insertions(+), 34 deletions(-) create mode 100644 plugins/messages/app/views/messages/_actionbar.haml diff --git a/plugins/messages/app/overrides/shared/_user_form_fields/add_messages_prefs.html.haml.deface b/plugins/messages/app/overrides/shared/_user_form_fields/add_messages_prefs.html.haml.deface index 4769106c..b41ef105 100644 --- a/plugins/messages/app/overrides/shared/_user_form_fields/add_messages_prefs.html.haml.deface +++ b/plugins/messages/app/overrides/shared/_user_form_fields/add_messages_prefs.html.haml.deface @@ -1,4 +1,9 @@ -/ insert_before 'erb:contains("simple_fields_for :notify")' +/ insert_after 'erb:contains("notify.input \'upcoming_tasks\'")' - if FoodsoftMessages.enabled? = s.simple_fields_for :messages, defaults: { inline_label: true, label: false } do |messages| = messages.input 'send_as_email', as: :boolean, input_html: { checked: f.object.settings.messages['send_as_email'] } + - if Messagegroup.any? + .controls + = link_to messagegroups_path do + = t('shared.user_form_fields.messagegroups') + %i.icon.icon-chevron-right diff --git a/plugins/messages/app/views/admin/messagegroups/index.html.haml b/plugins/messages/app/views/admin/messagegroups/index.html.haml index 03ef11f9..2be2cd20 100644 --- a/plugins/messages/app/views/admin/messagegroups/index.html.haml +++ b/plugins/messages/app/views/admin/messagegroups/index.html.haml @@ -5,6 +5,7 @@ - content_for :sidebar do %p= t('.first_paragraph', url: link_to(t('.new_messagegroups'), new_admin_messagegroup_path)).html_safe + %p= t '.second_paragraph' .well.well-small = form_tag admin_messagegroups_path, :method => :get, :remote => true, 'data-submit-onchange' => true, class: 'form-search' do diff --git a/plugins/messages/app/views/message_threads/index.html.haml b/plugins/messages/app/views/message_threads/index.html.haml index ff275ae1..a108897a 100644 --- a/plugins/messages/app/views/message_threads/index.html.haml +++ b/plugins/messages/app/views/message_threads/index.html.haml @@ -1,8 +1,6 @@ - title t('.title') -- content_for :actionbar do - = link_to t('.messages'), messages_path, class: 'btn' - = link_to t('.new'), new_message_path, class: 'btn btn-primary' += render 'messages/actionbar', active: 'message_threads' = render 'groupmessage_threads', group: nil, name: t('.other'), id: 0 diff --git a/plugins/messages/app/views/messagegroups/index.html.haml b/plugins/messages/app/views/messagegroups/index.html.haml index fd440e82..c588e515 100644 --- a/plugins/messages/app/views/messagegroups/index.html.haml +++ b/plugins/messages/app/views/messagegroups/index.html.haml @@ -1,5 +1,5 @@ - title t('.title') -= t('.body').html_safe +%p= t('.body') = render :partial => "messagegroup", :collection => @messagegroups diff --git a/plugins/messages/app/views/messages/_actionbar.haml b/plugins/messages/app/views/messages/_actionbar.haml new file mode 100644 index 00000000..4e3b44c9 --- /dev/null +++ b/plugins/messages/app/views/messages/_actionbar.haml @@ -0,0 +1,8 @@ +- content_for :actionbar do + .btn-group + = link_to message_threads_path, class: "btn #{'active' if active == 'message_threads'}" do + %i.icon.icon-align-left{title: t('.message_threads')} + = link_to messages_path, class: "btn #{'active' if active == 'messages'}" do + %i.icon.icon-align-justify{title: t('.messages')} + = link_to t('.messagegroups'), messagegroups_path, class: 'btn' + = link_to t('.new'), new_message_path, class: 'btn btn-primary' diff --git a/plugins/messages/app/views/messages/index.html.haml b/plugins/messages/app/views/messages/index.html.haml index b2126638..08c3b0d5 100644 --- a/plugins/messages/app/views/messages/index.html.haml +++ b/plugins/messages/app/views/messages/index.html.haml @@ -1,7 +1,6 @@ - title t('.title') -- content_for :actionbar do - = link_to t('.message_threads'), message_threads_path, class: 'btn' - = link_to t('.new'), new_message_path, class: 'btn btn-primary' += render 'actionbar', active: 'messages' + #messages = render 'messages', messages: @messages, pagination: true diff --git a/plugins/messages/config/locales/de.yml b/plugins/messages/config/locales/de.yml index 08584d44..8fb44fd1 100644 --- a/plugins/messages/config/locales/de.yml +++ b/plugins/messages/config/locales/de.yml @@ -18,6 +18,7 @@ de: first_paragraph: Hier kannst du %{url} anlegen, Gruppen bearbeiten und löschen. new_messagegroup: Neue Nachrichtengruppe anlegen new_messagegroups: neue Nachrichtengruppe + second_paragraph: Eine Nachrichtengruppe ist wie ein Mail-Verteilen. Mitglieder können Verteiler in ihrem Profil abonnieren (und auch wieder abbestellen) an denen sie interessiert sind. title: Nachrichtengruppen new: title: Nachrichtengruppe anlegen @@ -47,6 +48,12 @@ de: join: Nachrichtengruppe beitreten leave: Nachrichtengruppe verlassen messages: + actionbar: + message_threads: + messagegroups: + messages: + create: + notice: Message is saved and will be sent. index: message_threads: Nachrichtenverläufe thread: @@ -56,7 +63,6 @@ de: groupmessage_threads: show_message_threads: Alle Nachrichtenverläufe anzeigen index: - messages: Nachrichten new: Neue Nachricht other: Allgemeine Nachrichten title: Nachrichtenverläufe @@ -67,7 +73,7 @@ de: started_by: Gestartet von show: other: Allgemeine Nachrichten + reply: Antworten navigation: admin: messagegroups: Nachrichtengruppen - messagegroups: Nachrichtengruppen diff --git a/plugins/messages/config/locales/en.yml b/plugins/messages/config/locales/en.yml index 74133c84..d7deed05 100644 --- a/plugins/messages/config/locales/en.yml +++ b/plugins/messages/config/locales/en.yml @@ -14,26 +14,27 @@ en: user_tokens: Members models: message: Message - messagegroup: Messagegroup + messagegroup: Message group admin: messagegroups: destroy: - error: 'Messagegroup could not be deleted: %{error}' - notice: Messagegroup was deleted + error: 'Message group could not be deleted: %{error}' + notice: Message group was deleted edit: - title: Edit messagegroup + title: Edit message group index: first_paragraph: Here you can create %{url}, edit and delete them. - new_messagegroup: Create new messagegroup - new_messagegroups: new messagegroups - title: Messagegroups + new_messagegroup: Create new message group + new_messagegroups: new message groups + second_paragraph: "A message group is like a mailing-list. Members can subscribe to (and unsubscribe from) the lists they're interested in, from their profile." + title: Message groups new: - title: Create messagegroup + title: Create message group show: confirm: Are you sure? edit: Edit group/members send_message: Send message - title: Messagegroup %{name} + title: Message group %{name} messagegroups: members: Members name: Name @@ -61,28 +62,31 @@ en: home: index: messages: - title: Newest Messages + title: Newest messages view_all: See all messages start_nav: write_message: Write message messagegroups: index: - body: You can join or leave any of the messagegroups. - title: Messagegroups + body: 'A message group is like a mailing-list: you can join (or leave) any of them to receive the updates sent to that group.' + title: Message groups join: - error: 'Messagegroup could not be joined: %{error}' - notice: Messagegroup was joined + error: 'Could not join message group: %{error}' + notice: Joined message group leave: error: 'Messagegroup could not be left: %{error}' - notice: Messagegroup was left + notice: Left message group messagegroup: - join: Join messagegroup - leave: Leave messagegroup + join: Join message group + leave: Leave message group messages: + actionbar: + message_threads: Show as threads + messagegroups: Subscribe to groups + messages: Show as list create: notice: Message is saved and will be sent. index: - message_threads: View as threads new: New message title: Messages messages: @@ -116,11 +120,11 @@ en: title: Show message thread: all_message_threads: All message threads + reply: Reply message_threads: groupmessage_threads: show_message_threads: show all index: - messages: View as messages new: New message other: General title: Message threads @@ -139,6 +143,8 @@ en: ' navigation: admin: - messagegroups: Messagegroups - messagegroups: Messagegroups + messagegroups: Message groups messages: Messages + shared: + user_form_fields: + messagegroups: Join or leave message groups diff --git a/plugins/messages/lib/foodsoft_messages/engine.rb b/plugins/messages/lib/foodsoft_messages/engine.rb index 74aa7c58..237197cf 100644 --- a/plugins/messages/lib/foodsoft_messages/engine.rb +++ b/plugins/messages/lib/foodsoft_messages/engine.rb @@ -5,9 +5,7 @@ module FoodsoftMessages 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) + SimpleNavigation::Item.new(primary, :messages, 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))