Skip to content

Commit 79831f6

Browse files
feat(messages): Adds a confirmation modal to send messages (#272)
* feat(message): added a confirmation modal to send messages added a modal for when you send a message that displays the number of people you are sending it to in large red text. * fix: houndci formatting errors * fix(messages): fixed error and made changes to text made "send message" singular and made only the the number red. I also fixed the variable not loading properly * fix: houndci styling changes * feat: made email modal text black instead of red the email confirmation modal displays the number in black instead of red * refactor: Adds number delimiter to recipients, changes cancel outline Co-authored-by: Chris Baudouin, Jr <cjb5326@rit.edu>
1 parent e4169a7 commit 79831f6

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

app/views/manage/messages/show.html.haml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
:ruby
22
begin
3-
recipient_count = pluralize(BulkMessageJob.build_recipients(@message.recipients).count, "recipient")
3+
recipient_count = pluralize(BulkMessageJob.build_recipients(@message.recipients).count, "Recipient")
4+
number_of_recipients = BulkMessageJob.build_recipients(@message.recipients).count
5+
recipient_plural = "Recipient"
6+
if number_of_recipients > 1
7+
recipient_plural = "Recipients"
8+
end
9+
410
rescue => recipient_error
511
end
612

@@ -10,9 +16,25 @@
1016
- if recipient_error.present?
1117
%button.btn.btn-sm.btn-outline-secondary{disabled: 'disabled', title: 'Cannot deliver when there is a recipient error; see error above.'} Deliver
1218
- else
13-
= link_to deliver_manage_message_path(@message), method: :patch, data: { confirm: "Are you sure? The message \"#{@message.name}\" will be sent to #{recipient_count}." }, class: 'btn btn-sm btn-primary' do
19+
%button.btn.btn-sm.btn-primary{"data-toggle"=>"modal", "data-target"=>"#confirm-messages"}
1420
%span.fa.fa-send.icon-space-r-half
15-
Send
21+
%span Send
22+
.modal{:id => "confirm-messages"}
23+
.modal-dialog{:role => "document"}
24+
.modal-content
25+
.modal-header
26+
%h5{:class => "modal-title"} Confirm
27+
.modal-body
28+
%p Are you sure? The message "#{@message.name}" will be sent to:
29+
%h3.center
30+
%span.font-weight-bold
31+
= number_with_delimiter(number_of_recipients)
32+
%span
33+
= recipient_plural
34+
.modal-footer
35+
%button.btn.btn-outline-secondary{'data-dismiss'=>"modal"} Close
36+
= link_to deliver_manage_message_path(@message), method: :patch, class: 'btn btn-danger' do
37+
%span Send Message
1638
- if @message.can_edit?
1739
= link_to 'Edit', edit_manage_message_path(@message), class: 'btn btn-sm btn-outline-secondary'
1840
= link_to 'Delete', manage_message_path(@message), method: :delete, data: { confirm: "Are you sure? The message \"#{@message.name}\" will be permanently erased. This action is irreversible." }, class: 'btn btn-sm btn-outline-secondary'

0 commit comments

Comments
 (0)