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:
parent
b30b4e46d8
commit
01cf6431a9
15 changed files with 172 additions and 9 deletions
|
|
@ -0,0 +1,5 @@
|
|||
= simple_form_for [:admin, @messagegroup] do |f|
|
||||
= render 'shared/group_form_fields', :f => f
|
||||
.form-actions
|
||||
= f.button :submit
|
||||
= link_to t('ui.or_cancel'), :back
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
- if Messagegroup.count > 20
|
||||
= items_per_page
|
||||
= pagination_links_remote @messagegroups
|
||||
%table.table.table-striped
|
||||
%thead
|
||||
%tr
|
||||
%th= t '.name'
|
||||
%th= t '.members'
|
||||
%th= t 'ui.actions'
|
||||
%tbody
|
||||
- for messagegroup in @messagegroups
|
||||
%tr
|
||||
%td= link_to messagegroup.name, [:admin, messagegroup]
|
||||
%td= messagegroup.users.size
|
||||
%td
|
||||
= link_to t('ui.edit'), edit_admin_messagegroup_path(messagegroup), class: 'btn btn-mini'
|
||||
= link_to t('ui.delete'), [:admin, messagegroup], :data => {:confirm => t('admin.confirm', name: messagegroup.name)},
|
||||
:method => :delete, class: 'btn btn-mini btn-danger'
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
- title t '.title'
|
||||
|
||||
= render 'form'
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
- title t '.title'
|
||||
|
||||
- content_for :actionbar do
|
||||
= link_to t('.new_messagegroup'), new_admin_messagegroup_path, class: 'btn btn-primary'
|
||||
|
||||
- content_for :sidebar do
|
||||
%p= t('.first_paragraph', url: link_to(t('.new_messagegroups'), new_admin_messagegroup_path)).html_safe
|
||||
.well.well-small
|
||||
= form_tag admin_messagegroups_path, :method => :get, :remote => true,
|
||||
'data-submit-onchange' => true, class: 'form-search' do
|
||||
= text_field_tag :query, params[:query], class: 'input-medium search-query',
|
||||
placeholder: t('admin.search_placeholder')
|
||||
#messagegroups
|
||||
= render "messagegroups"
|
||||
|
|
@ -0,0 +1 @@
|
|||
$('#messagegroups').html('#{escape_javascript(render("messagegroups"))}');
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
- title t '.title'
|
||||
|
||||
= render 'form'
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
- title t '.title', name: @messagegroup.name
|
||||
|
||||
%section= render 'shared/group', group: @messagegroup
|
||||
= link_to t('ui.edit'), edit_admin_messagegroup_path(@messagegroup), class: 'btn'
|
||||
= link_to t('ui.delete'), [:admin, @messagegroup], :data => {:confirm => t('.confirm')}, :method => :delete, class: 'btn btn-danger'
|
||||
= link_to t('.send_message'), new_message_path(:message => {:group_id => @messagegroup.id}), class: 'btn'
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
%section.well
|
||||
%h3= messagegroup.name
|
||||
= render :partial => 'shared/group', :locals => { :group => messagegroup }
|
||||
= link_to_new_message(message_params: {group_id: messagegroup.id})
|
||||
- if messagegroup.member?(current_user)
|
||||
= link_to t('.leave'), leave_messagegroup_path(messagegroup), class: 'btn', method: :post
|
||||
- else
|
||||
= link_to t('.join'), join_messagegroup_path(messagegroup), class: 'btn', method: :post
|
||||
5
plugins/messages/app/views/messagegroups/index.html.haml
Normal file
5
plugins/messages/app/views/messagegroups/index.html.haml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
- title t('.title')
|
||||
|
||||
= t('.body').html_safe
|
||||
|
||||
= render :partial => "messagegroup", :collection => @messagegroups
|
||||
Loading…
Add table
Add a link
Reference in a new issue