|
1 | 1 | :ruby
|
2 | 2 | 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 | + |
4 | 10 | rescue => recipient_error
|
5 | 11 | end
|
6 | 12 |
|
|
10 | 16 | - if recipient_error.present?
|
11 | 17 | %button.btn.btn-sm.btn-outline-secondary{disabled: 'disabled', title: 'Cannot deliver when there is a recipient error; see error above.'} Deliver
|
12 | 18 | - 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"} |
14 | 20 | %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 |
16 | 38 | - if @message.can_edit?
|
17 | 39 | = link_to 'Edit', edit_manage_message_path(@message), class: 'btn btn-sm btn-outline-secondary'
|
18 | 40 | = 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