message_train 0.5.3 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 279f6b86182280de36d875bc58b839cffefbb5bd
4
- data.tar.gz: 24ad6a58c91cf45ddc80f645c642a12e480ef106
3
+ metadata.gz: 22a2a975ced65cb55871dcfa1f5a2a0e8bf84f7c
4
+ data.tar.gz: cbad8e0df97bd6caef57802f258e4bfa1d6644b1
5
5
  SHA512:
6
- metadata.gz: 20e06ae5d8f27c9760a5bc05ee3b46a59df822824ef8929b92eb93905006b5d6a670ce6a7c34c8cf9fdc94eecbad77f987b6ccdb4df75bc0f8b8b4a3d1fe35c0
7
- data.tar.gz: 396db8fa546546fa128a7bdeea851bc377e8340bbffbe16f7f4d0db302ecef3d6cb72d10445ecefaf6b69119cd398dc447197b6b9e09f5022e33984c5dc3b2c2
6
+ metadata.gz: a165b762a0af4973aa939c3deb7b2a836b9fd993dc96b5ac3ce20a97fa3f6ed838df503393a0cd0e0ca4918cd1db0606256f13750ee830808b51b6d2b43c5d5c
7
+ data.tar.gz: 954357e4d1563d1b5d61f6f678b7caecde7ffe30cb5541206398325168b1573f95baf18cf524b701c721bae87d41b605f3f091ef3dfbd65df0a2da348129cde3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.3
1
+ 0.6.0
@@ -58,5 +58,33 @@ module MessageTrain
58
58
  participant.id
59
59
  )
60
60
  end
61
+
62
+ def boxes_dropdown_cache_key(boxes)
63
+ parts = [
64
+ 'boxes-dropdown',
65
+ @box_user
66
+ ]
67
+ updated_at = boxes.collect do |x|
68
+ x.conversations && x.conversations.maximum(:updated_at)
69
+ end.compact.max
70
+ updated_at && parts << [
71
+ updated_at
72
+ ]
73
+ parts
74
+ end
75
+
76
+ def boxes_widget_cache_key(boxes)
77
+ parts = [
78
+ 'boxes-widget',
79
+ @box_user
80
+ ]
81
+ updated_at = boxes.collect do |x|
82
+ x.conversations && x.conversations.maximum(:updated_at)
83
+ end.compact.max
84
+ updated_at && parts << [
85
+ updated_at
86
+ ]
87
+ parts
88
+ end
61
89
  end
62
90
  end
@@ -70,5 +70,22 @@ module MessageTrain
70
70
  ]
71
71
  )
72
72
  end
73
+
74
+ def collectives_cache_key(collective_boxes, box_user)
75
+ parts = [
76
+ 'collectives-dropdown',
77
+ box_user
78
+ ]
79
+ collective_boxes.collect do |table_name, x|
80
+ updated_at = x.collect do |y|
81
+ y.conversations && y.conversations.maximum(:updated_at)
82
+ end.compact.max
83
+ updated_at && parts << [
84
+ table_name,
85
+ updated_at
86
+ ]
87
+ end
88
+ parts
89
+ end
73
90
  end
74
91
  end
@@ -1,7 +1,7 @@
1
1
  module MessageTrain
2
2
  # Attachment model
3
3
  class Attachment < ActiveRecord::Base
4
- belongs_to :message, foreign_key: :message_train_message_id
4
+ belongs_to :message, foreign_key: :message_train_message_id, touch: true
5
5
  has_attached_file(
6
6
  :attachment,
7
7
  styles: lambda do |attachment|
@@ -2,7 +2,11 @@ module MessageTrain
2
2
  # Ignore model
3
3
  class Ignore < ActiveRecord::Base
4
4
  belongs_to :participant, polymorphic: true
5
- belongs_to :conversation, foreign_key: :message_train_conversation_id
5
+ belongs_to(
6
+ :conversation,
7
+ foreign_key: :message_train_conversation_id,
8
+ touch: true
9
+ )
6
10
 
7
11
  validates_presence_of :conversation, :participant
8
12
 
@@ -5,7 +5,11 @@ module MessageTrain
5
5
  serialize :recipients_to_save, Hash
6
6
 
7
7
  # Relationships
8
- belongs_to :conversation, foreign_key: :message_train_conversation_id
8
+ belongs_to(
9
+ :conversation,
10
+ foreign_key: :message_train_conversation_id,
11
+ touch: true
12
+ )
9
13
  belongs_to :sender, polymorphic: true
10
14
  has_many :attachments, foreign_key: :message_train_message_id
11
15
  has_many :receipts, foreign_key: :message_train_message_id
@@ -44,7 +48,7 @@ module MessageTrain
44
48
  end
45
49
 
46
50
  def self.mark(mark_to_set, participant)
47
- where(nil).each do |message|
51
+ find_each do |message|
48
52
  message.mark(mark_to_set, participant)
49
53
  end
50
54
  end
@@ -3,7 +3,11 @@ module MessageTrain
3
3
  class Receipt < ActiveRecord::Base
4
4
  belongs_to :recipient, polymorphic: true
5
5
  belongs_to :received_through, polymorphic: true
6
- belongs_to :message, foreign_key: :message_train_message_id
6
+ belongs_to(
7
+ :message,
8
+ foreign_key: :message_train_message_id,
9
+ touch: true
10
+ )
7
11
  validates_presence_of :recipient, :message
8
12
 
9
13
  default_scope { order(updated_at: :desc) }
@@ -1,4 +1,5 @@
1
- - unless boxes.empty?
2
- = dropdown_nav_item "#{:box_title_in.l} #{badge(boxes.first.unread_count.to_s) unless boxes.first.unread_count == 0}".html_safe, '#' do
3
- - boxes.each do |box|
4
- = box_nav_item box
1
+ - cache boxes_dropdown_cache_key(boxes), 'message-train' do
2
+ - unless boxes.empty?
3
+ = dropdown_nav_item "#{:box_title_in.l} #{badge(boxes.first.unread_count.to_s) unless boxes.first.unread_count == 0}".html_safe, '#' do
4
+ - boxes.each do |box|
5
+ = box_nav_item box
@@ -1,5 +1,6 @@
1
- - if box.present?
2
- %li{ html_options }
3
- = link_to box.title, message_train.box_path(box.division)
4
- - if unread_count > 0
5
- = badge unread_count.to_s
1
+ - cache ['boxes-list-item', @box_user, box], 'message-train' do
2
+ - if box.present?
3
+ %li{ html_options }
4
+ = link_to box.title, message_train.box_path(box.division)
5
+ - if unread_count > 0
6
+ = badge unread_count.to_s
@@ -1,10 +1,11 @@
1
1
  - unless boxes.empty?
2
- .hidden-print
3
- %h3= :messages.l
4
- .text-center= link_to :compose.l, message_train.new_box_message_path(:in), class: 'btn btn-lg btn-primary btn-compose'
5
- %ul.list-group
6
- - boxes.each do |box|
7
- - if @collective.nil?
8
- = box_list_item box, class: 'list-group-item'
9
- - else
10
- = collective_list_item box, class: 'list-group-item'
2
+ - cache boxes_widget_cache_key(boxes), 'message-train' do
3
+ .hidden-print
4
+ %h3= :messages.l
5
+ .text-center= link_to :compose.l, message_train.new_box_message_path(:in), class: 'btn btn-lg btn-primary btn-compose'
6
+ %ul.list-group
7
+ - boxes.each do |box|
8
+ - if @collective.nil?
9
+ = box_list_item box, class: 'list-group-item'
10
+ - else
11
+ = collective_list_item box, class: 'list-group-item'
@@ -4,52 +4,53 @@
4
4
  - else
5
5
  - add_title collective_name(@collective) + ' ' + @box.title
6
6
  - marking_path = message_train.collective_box_path(@collective.path_part, @box.division)
7
- = form_tag marking_path, method: :put, remote: true, id: 'box', data: { type: :json } do
8
- - unless @conversations.empty?
9
- #box-actions.box-actions
10
- .btn-group.check-all
11
- %button.btn.btn-default{ type: 'button' }
12
- = check_box_tag 'check_all', 'all', false
13
- %button.btn.btn-default.dropdown-toggle{ aria: { expanded: 'false', haspopup: 'true' }, data: { toggle: 'dropdown'}, type: 'button' }
14
- %span.caret
15
- %span.sr-only= :toggle_dropdown.l
16
- %ul.dropdown-menu
17
- %li
18
- = link_to :all.l, '#0', class: 'check', data: { selector: '.message_train_conversation'}
19
- = link_to :none.l, '#0', class: 'check', data: { selector: ''}
20
- = link_to :read.l, '#0', class: 'check', data: { selector: '.message_train_conversation.read'}
21
- = link_to :unread.l, '#0', class: 'check', data: { selector: '.message_train_conversation.unread'}
22
- .btn-group
23
- %button.btn.btn-info.dropdown-toggle{ aria: { expanded: 'false', haspopup: 'true' }, data: { toggle: 'dropdown'}, type: 'button' }
24
- = :mark.l
25
- %span.caret
26
- %ul.dropdown-menu
27
- %li
28
- = link_to :mark_as_name.l(name: :read.l), '#0', class: 'mark', id: 'mark-read', data: { mark: 'read'}
29
- %li
30
- = link_to :mark_as_name.l(name: :unread.l), '#0', class: 'mark', id: 'mark-unread', data: { mark: 'unread'}
31
- - if @box.division == :trash
7
+ - cache ['boxes-show', @box_user, @box], 'message-train' do
8
+ = form_tag marking_path, method: :put, remote: true, id: 'box', data: { type: :json } do
9
+ - unless @conversations.empty?
10
+ #box-actions.box-actions
11
+ .btn-group.check-all
12
+ %button.btn.btn-default{ type: 'button' }
13
+ = check_box_tag 'check_all', 'all', false
14
+ %button.btn.btn-default.dropdown-toggle{ aria: { expanded: 'false', haspopup: 'true' }, data: { toggle: 'dropdown'}, type: 'button' }
15
+ %span.caret
16
+ %span.sr-only= :toggle_dropdown.l
17
+ %ul.dropdown-menu
32
18
  %li
33
- = link_to :mark_as_name.l(name: :untrashed.l), '#0', class: 'mark', id: 'mark-untrash', data: { mark: 'untrash'}
34
- %li.divider{ role: 'separator' }
35
- %li
36
- = link_to :mark_as_name.l(name: :deleted.l), '#0', class: 'mark', id: 'mark-deleted', data: { mark: 'deleted'}
37
- - else
19
+ = link_to :all.l, '#0', class: 'check', data: { selector: '.message_train_conversation'}
20
+ = link_to :none.l, '#0', class: 'check', data: { selector: ''}
21
+ = link_to :read.l, '#0', class: 'check', data: { selector: '.message_train_conversation.read'}
22
+ = link_to :unread.l, '#0', class: 'check', data: { selector: '.message_train_conversation.unread'}
23
+ .btn-group
24
+ %button.btn.btn-info.dropdown-toggle{ aria: { expanded: 'false', haspopup: 'true' }, data: { toggle: 'dropdown'}, type: 'button' }
25
+ = :mark.l
26
+ %span.caret
27
+ %ul.dropdown-menu
38
28
  %li
39
- = link_to :mark_as_name.l(name: :trashed.l), '#0', class: 'mark', id: 'mark-trash', data: { mark: 'trash'}
40
- %li.divider{ role: 'separator' }
41
- - if @box.division == :ignored
29
+ = link_to :mark_as_name.l(name: :read.l), '#0', class: 'mark', id: 'mark-read', data: { mark: 'read'}
42
30
  %li
43
- = link_to :mark_as_name.l(name: :unignored.l), '#0', class: 'mark', id: 'mark-unignored', data: { mark: 'unignore'}
44
- - else
45
- %li
46
- = link_to :mark_as_name.l(name: :ignored.l), '#0', class: 'mark', id: 'mark-ignored', data: { mark: 'ignore'}
47
- - if @collective.nil?
48
- = link_to :compose.l, message_train.new_box_message_path(@box.division), class: 'btn btn-primary compose'
49
- - elsif @collective.allows_sending_by? @box_user
50
- = link_to :compose_to_collective.l(collective: collective_name(@collective)), message_train.new_collective_box_message_path(@collective.path_part, @box.division), class: 'btn btn-primary compose'
51
- %span#spinner.hide= icon 'refresh spinning'
52
- = hidden_field_tag :mark_to_set
53
- %table#message-train-conversations.message-train-conversations.table.table-condensed
54
- = render @conversations
55
- = paginate @conversations
31
+ = link_to :mark_as_name.l(name: :unread.l), '#0', class: 'mark', id: 'mark-unread', data: { mark: 'unread'}
32
+ - if @box.division == :trash
33
+ %li
34
+ = link_to :mark_as_name.l(name: :untrashed.l), '#0', class: 'mark', id: 'mark-untrash', data: { mark: 'untrash'}
35
+ %li.divider{ role: 'separator' }
36
+ %li
37
+ = link_to :mark_as_name.l(name: :deleted.l), '#0', class: 'mark', id: 'mark-deleted', data: { mark: 'deleted'}
38
+ - else
39
+ %li
40
+ = link_to :mark_as_name.l(name: :trashed.l), '#0', class: 'mark', id: 'mark-trash', data: { mark: 'trash'}
41
+ %li.divider{ role: 'separator' }
42
+ - if @box.division == :ignored
43
+ %li
44
+ = link_to :mark_as_name.l(name: :unignored.l), '#0', class: 'mark', id: 'mark-unignored', data: { mark: 'unignore'}
45
+ - else
46
+ %li
47
+ = link_to :mark_as_name.l(name: :ignored.l), '#0', class: 'mark', id: 'mark-ignored', data: { mark: 'ignore'}
48
+ - if @collective.nil?
49
+ = link_to :compose.l, message_train.new_box_message_path(@box.division), class: 'btn btn-primary compose'
50
+ - elsif @collective.allows_sending_by? @box_user
51
+ = link_to :compose_to_collective.l(collective: collective_name(@collective)), message_train.new_collective_box_message_path(@collective.path_part, @box.division), class: 'btn btn-primary compose'
52
+ %span#spinner.hide= icon 'refresh spinning'
53
+ = hidden_field_tag :mark_to_set
54
+ %table#message-train-conversations.message-train-conversations.table.table-condensed
55
+ = render @conversations
56
+ = paginate @conversations
@@ -1,6 +1,7 @@
1
- - unless collective_boxes.empty?
2
- - collective_boxes.each do |key, boxes|
3
- - if show[key]
4
- = dropdown_nav_item "#{key.to_s.humanize} #{badge(total_unread_count[key].to_s) unless total_unread_count[key] == 0}".html_safe, '#' do
5
- - boxes.each do |box|
6
- = collective_nav_item box, box_user
1
+ - cache collectives_cache_key(collective_boxes, box_user), 'message-train' do
2
+ - unless collective_boxes.empty?
3
+ - collective_boxes.each do |key, boxes|
4
+ - if show[key]
5
+ = dropdown_nav_item "#{key.to_s.humanize} #{badge(total_unread_count[key].to_s) unless total_unread_count[key] == 0}".html_safe, '#' do
6
+ - boxes.each do |box|
7
+ = collective_nav_item box, box_user
@@ -1,5 +1,6 @@
1
- - if box.present?
2
- %li{ html_options }
3
- = link_to box.title, message_train.collective_box_path(box.parent.path_part, box.division)
4
- - if unread_count > 0
5
- = badge unread_count.to_s
1
+ - cache ['collectives-list-item', @box_user, box], 'message-train' do
2
+ - if box.present?
3
+ %li{ html_options }
4
+ = link_to box.title, message_train.collective_box_path(box.parent.path_part, box.division)
5
+ - if unread_count > 0
6
+ = badge unread_count.to_s
@@ -1,8 +1,9 @@
1
- - unless collective.boxes_for_participant(box_user).empty?
2
- .hidden-print
3
- %h3= :collective_messages.l(collective: collective_name(collective))
4
- - if collective.allows_sending_by?(box_user)
5
- .text-center= link_to :compose_to_collective.l(collective: collective_name(collective)), message_train.new_collective_box_message_path(collective.path_part, :sent), class: 'btn btn-lg btn-primary btn-compose'
6
- %ul.list-group
7
- - collective.boxes_for_participant(box_user).each do |box|
8
- = collective_list_item box, class: 'list-group-item'
1
+ - cache ['collectives-widget', box_user, collective], 'message-train' do
2
+ - unless collective.boxes_for_participant(box_user).empty?
3
+ .hidden-print
4
+ %h3= :collective_messages.l(collective: collective_name(collective))
5
+ - if collective.allows_sending_by?(box_user)
6
+ .text-center= link_to :compose_to_collective.l(collective: collective_name(collective)), message_train.new_collective_box_message_path(collective.path_part, :sent), class: 'btn btn-lg btn-primary btn-compose'
7
+ %ul.list-group
8
+ - collective.boxes_for_participant(box_user).each do |box|
9
+ = collective_list_item box, class: 'list-group-item'
@@ -1,24 +1,25 @@
1
- %tr.message_train_conversation{ class: conversation_class(@box, conversation), id: 'message_train_conversation_' + conversation.id.to_s }
2
- %td.col-xs-1= check_box_tag "objects[conversations][#{conversation.id.to_s}]", conversation.id
3
- - if @collective.nil?
4
- %td.col-xs-2= link_to conversation_senders(conversation), message_train.box_conversation_path(@box.division, conversation)
5
- %td.col-xs-8= link_to conversation.subject, message_train.box_conversation_path(@box.division, conversation)
6
- %td
7
- - if conversation.attachments.any?
8
- = icon 'paperclip'
9
- %td.col-xs-1.conversation-actions
10
- = conversation_trashed_toggle conversation
11
- - if @box.division == :trash
12
- = conversation_deleted_toggle conversation
13
- %td.col-xs-1.date-column= fuzzy_date(conversation.updated_at)
14
- - else
15
- %td.col-xs-2= link_to conversation_senders(conversation), message_train.collective_box_conversation_path(@collective.path_part, @box.division, conversation)
16
- %td.col-xs-8= link_to conversation.subject, message_train.collective_box_conversation_path(@collective.path_part, @box.division, conversation)
17
- %td
18
- - if conversation.attachments.any?
19
- = icon 'paperclip'
20
- %td.col-xs-1.conversation-actions
21
- = conversation_trashed_toggle conversation, @collective
22
- - if @box.division == :trash
23
- = conversation_deleted_toggle conversation, @collective
24
- %td.col-xs-1.date-column= fuzzy_date(conversation.updated_at)
1
+ - cache ['conversation-result', @box_user, conversation], 'message-train' do
2
+ %tr.message_train_conversation{ class: conversation_class(@box, conversation), id: 'message_train_conversation_' + conversation.id.to_s }
3
+ %td.col-xs-1= check_box_tag "objects[conversations][#{conversation.id.to_s}]", conversation.id
4
+ - if @collective.nil?
5
+ %td.col-xs-2= link_to conversation_senders(conversation), message_train.box_conversation_path(@box.division, conversation)
6
+ %td.col-xs-8= link_to conversation.subject, message_train.box_conversation_path(@box.division, conversation)
7
+ %td
8
+ - if conversation.attachments.any?
9
+ = icon 'paperclip'
10
+ %td.col-xs-1.conversation-actions
11
+ = conversation_trashed_toggle conversation
12
+ - if @box.division == :trash
13
+ = conversation_deleted_toggle conversation
14
+ %td.col-xs-1.date-column= fuzzy_date(conversation.updated_at)
15
+ - else
16
+ %td.col-xs-2= link_to conversation_senders(conversation), message_train.collective_box_conversation_path(@collective.path_part, @box.division, conversation)
17
+ %td.col-xs-8= link_to conversation.subject, message_train.collective_box_conversation_path(@collective.path_part, @box.division, conversation)
18
+ %td
19
+ - if conversation.attachments.any?
20
+ = icon 'paperclip'
21
+ %td.col-xs-1.conversation-actions
22
+ = conversation_trashed_toggle conversation, @collective
23
+ - if @box.division == :trash
24
+ = conversation_deleted_toggle conversation, @collective
25
+ %td.col-xs-1.date-column= fuzzy_date(conversation.updated_at)
@@ -1,12 +1,13 @@
1
1
  - add_title @conversation.subject
2
2
  - add_subtitle :updated_at_time.l(time: @conversation.updated_at)
3
- #box
4
- #conversation-actions.conversation-actions.pull-right
5
- .btn.btn-default.btn-lg= conversation_ignored_toggle(@conversation)
6
- #message_train_conversation.clear-both
7
- - unless @messages.empty?
8
- #message_train_messages.messages.panel-group{aria: { multiselectable: 'true' }, role: 'tablist'}
9
- = render @messages
10
- = paginate @messages
11
- = modal 'attachment_preview', :attachment_preview.l do
12
- #image_placeholder
3
+ - cache ['conversations-show', @box_user, @conversation], 'message-train' do
4
+ #box
5
+ #conversation-actions.conversation-actions.pull-right
6
+ .btn.btn-default.btn-lg= conversation_ignored_toggle(@conversation)
7
+ #message_train_conversation.clear-both
8
+ - unless @messages.empty?
9
+ #message_train_messages.messages.panel-group{aria: { multiselectable: 'true' }, role: 'tablist'}
10
+ = render @messages
11
+ = paginate @messages
12
+ = modal 'attachment_preview', :attachment_preview.l do
13
+ #image_placeholder
@@ -1,45 +1,46 @@
1
- - if message.draft
2
- .panel.panel-default{ class: message_class(@box, message), id: "message_train_message_#{message.id}", data: { mark_path: message_train.box_conversation_path(@box.division, id: message.message_train_conversation_id, objects: { 'messages' => {message.id.to_s => message.id.to_s} }) } }
3
- .panel-heading{role: 'tab', id: "message_#{message.id}_heading"}
4
- .message-actions.pull-right
5
- = message_read_toggle message
6
- = message_trashed_toggle message
7
- - if @box.division == :trash
8
- = message_deleted_toggle message
9
- %h4.panel-title
10
- = link_to "#message_#{message.id}_collapse", aria: { controls: "message_#{message.id}_collapse", expanded: 'true' }, data: { parent: '#accordion', toggle: 'collapse' }, role: 'button' do
11
- %span.caret
12
- = :message_draft.l
13
- %small= message.updated_at
14
- .panel-collapse.collapse.in{aria: { labelledby: "message_#{message.id}_heading" }, role: 'tabpanel', id: "message_#{message.id}_collapse"}
15
- .panel-body
16
- = render partial: 'message_train/messages/form', locals: { message: message }
17
- - else
18
- .panel.panel-default{ class: message_class(@box, message), id: "message_train_message_#{message.id}", data: { mark_path: message_train.box_conversation_path(@box.division, id: message.message_train_conversation_id, objects: { 'messages' => {message.id.to_s => message.id.to_s} }) } }
19
- .panel-heading{role: 'tab', id: "message_#{message.id}_heading"}
20
- .message-actions.pull-right
21
- = message_read_toggle message
22
- = message_trashed_toggle message
23
- - if @box.division == :trash
24
- = message_deleted_toggle message
25
- %h4.panel-title
26
- = link_to "#message_#{message.id}_collapse", aria: { controls: "message_#{message.id}_collapse", expanded: 'true' }, data: { parent: '#accordion', toggle: 'collapse' }, role: 'button' do
27
- %span.caret
28
- = :from_sender.l(sender: message.sender.display_name)
29
- %small= message.updated_at
30
- .panel-collapse.collapse.in{aria: { labelledby: "message_#{message.id}_heading" }, role: 'tabpanel', id: "message_#{message.id}_collapse"}
31
- .panel-body
32
- %p= :to_recipient.l(recipient: message_recipients(message))
33
- %p.lead= message.subject
34
- = sanitize message.body
35
- - if message.attachments.any?
36
- .row.attachment-thumbnails
37
- - for attachment in message.attachments
38
- .col-md-4
39
- = attachment_link(attachment)
40
- - if @box.parent.allows_sending_by?(@box_user)
41
- .panel-footer
42
- - if @collective.nil?
43
- = link_to :reply.l, message_train.new_box_message_path(@box, conversation_id: message.message_train_conversation_id), class: 'btn btn-primary'
44
- - else
45
- = link_to :reply.l, message_train.new_collective_box_message_path(@collective.path_part, @box, conversation_id: message.message_train_conversation_id), class: 'btn btn-primary'
1
+ - cache ['message-result', @box_user, message], 'message-train' do
2
+ - if message.draft
3
+ .panel.panel-default{ class: message_class(@box, message), id: "message_train_message_#{message.id}", data: { mark_path: message_train.box_conversation_path(@box.division, id: message.message_train_conversation_id, objects: { 'messages' => {message.id.to_s => message.id.to_s} }) } }
4
+ .panel-heading{role: 'tab', id: "message_#{message.id}_heading"}
5
+ .message-actions.pull-right
6
+ = message_read_toggle message
7
+ = message_trashed_toggle message
8
+ - if @box.division == :trash
9
+ = message_deleted_toggle message
10
+ %h4.panel-title
11
+ = link_to "#message_#{message.id}_collapse", aria: { controls: "message_#{message.id}_collapse", expanded: 'true' }, data: { parent: '#accordion', toggle: 'collapse' }, role: 'button' do
12
+ %span.caret
13
+ = :message_draft.l
14
+ %small= message.updated_at
15
+ .panel-collapse.collapse.in{aria: { labelledby: "message_#{message.id}_heading" }, role: 'tabpanel', id: "message_#{message.id}_collapse"}
16
+ .panel-body
17
+ = render partial: 'message_train/messages/form', locals: { message: message }
18
+ - else
19
+ .panel.panel-default{ class: message_class(@box, message), id: "message_train_message_#{message.id}", data: { mark_path: message_train.box_conversation_path(@box.division, id: message.message_train_conversation_id, objects: { 'messages' => {message.id.to_s => message.id.to_s} }) } }
20
+ .panel-heading{role: 'tab', id: "message_#{message.id}_heading"}
21
+ .message-actions.pull-right
22
+ = message_read_toggle message
23
+ = message_trashed_toggle message
24
+ - if @box.division == :trash
25
+ = message_deleted_toggle message
26
+ %h4.panel-title
27
+ = link_to "#message_#{message.id}_collapse", aria: { controls: "message_#{message.id}_collapse", expanded: 'true' }, data: { parent: '#accordion', toggle: 'collapse' }, role: 'button' do
28
+ %span.caret
29
+ = :from_sender.l(sender: message.sender.display_name)
30
+ %small= message.updated_at
31
+ .panel-collapse.collapse.in{aria: { labelledby: "message_#{message.id}_heading" }, role: 'tabpanel', id: "message_#{message.id}_collapse"}
32
+ .panel-body
33
+ %p= :to_recipient.l(recipient: message_recipients(message))
34
+ %p.lead= message.subject
35
+ = sanitize message.body
36
+ - if message.attachments.any?
37
+ .row.attachment-thumbnails
38
+ - for attachment in message.attachments
39
+ .col-md-4
40
+ = attachment_link(attachment)
41
+ - if @box.parent.allows_sending_by?(@box_user)
42
+ .panel-footer
43
+ - if @collective.nil?
44
+ = link_to :reply.l, message_train.new_box_message_path(@box, conversation_id: message.message_train_conversation_id), class: 'btn btn-primary'
45
+ - else
46
+ = link_to :reply.l, message_train.new_collective_box_message_path(@collective.path_part, @box, conversation_id: message.message_train_conversation_id), class: 'btn btn-primary'
@@ -1,5 +1,5 @@
1
1
  - add_title :manage_your_email_notifications.l
2
- - if current_user.unsubscribed_from_all?
2
+ - if @box_user.unsubscribed_from_all?
3
3
  %p= :you_have_chosen_not_to_be_emailed.l
4
4
  %p= icon_button_to 'primary', 'check', :enable_some_notifications.l, message_train.unsubscribes_all_path, method: :delete
5
5
  - else
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: message_train 0.5.3 ruby lib
5
+ # stub: message_train 0.6.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "message_train"
9
- s.version = "0.5.3"
9
+ s.version = "0.6.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Karen Lundgren"]
14
- s.date = "2016-03-02"
14
+ s.date = "2016-03-03"
15
15
  s.description = "Rails 4 Engine providing private/public messaging for any object, such as Users or Groups"
16
16
  s.email = "karen.e.lundgren@gmail.com"
17
17
  s.extra_rdoc_files = [
Binary file
@@ -16,6 +16,7 @@ RSpec.feature 'Messages' do
16
16
  fill_in 'Subject', with: 'This is a draft.'
17
17
  fill_in_ckeditor 'Body', with: 'This is the body.'
18
18
  submit_via_button 'Send'
19
+ wait_until { page.has_css? '.alert' }
19
20
  end
20
21
  it_behaves_like(
21
22
  'a bootstrap page with an alert',
@@ -52,6 +53,7 @@ RSpec.feature 'Messages' do
52
53
  end
53
54
  end
54
55
  submit_via_button 'Send'
56
+ wait_until { page.has_css? '.alert' }
55
57
  end
56
58
  it_behaves_like(
57
59
  'a bootstrap page with an alert',
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: message_train
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karen Lundgren
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-02 00:00:00.000000000 Z
11
+ date: 2016-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails