From 0e523f358e2113f76ad986980edb3cfe316538dd Mon Sep 17 00:00:00 2001 From: Jeremy Rudman Date: Tue, 23 Jun 2020 14:11:41 -0400 Subject: [PATCH 1/6] 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. --- app/views/manage/messages/show.html.haml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/app/views/manage/messages/show.html.haml b/app/views/manage/messages/show.html.haml index bad3228ad..f2a546f6b 100644 --- a/app/views/manage/messages/show.html.haml +++ b/app/views/manage/messages/show.html.haml @@ -1,6 +1,6 @@ :ruby begin - recipient_count = pluralize(BulkMessageJob.build_recipients(@message.recipients).count, "recipient") + recipient_count = pluralize(BulkMessageJob.build_recipients(@message.recipients).count, "Recipient") rescue => recipient_error end @@ -10,9 +10,21 @@ - if recipient_error.present? %button.btn.btn-sm.btn-outline-secondary{disabled: 'disabled', title: 'Cannot deliver when there is a recipient error; see error above.'} Deliver - else - = 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 + %button.btn.btn-sm.btn-primary{"data-toggle"=>"modal", "data-target"=>"#confirm_messages"} %span.fa.fa-send.icon-space-r-half - Send + %span Send + .modal{:id => "confirm_messages"} + .modal-dialog{:role => "document"} + .modal-content + .modal-header + %h5{:class => "modal-title"} Confirm + .modal-body + %p Are you sure? The message "#{@message.name}" will be sent to: + %p.center.font-weight-bold{:style => "color: red; font-size: 18px"} #{recipient_count} + .modal-footer + %button.btn.btn-secondary{'data-dismiss'=>"modal"} Close + = link_to deliver_manage_message_path(@message), method: :patch, class: 'btn btn-danger' do + %span Send Messages - if @message.can_edit? = link_to 'Edit', edit_manage_message_path(@message), class: 'btn btn-sm btn-outline-secondary' = 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' From 6f49aceae6c446485d5b99a6d9e0a2f32604becc Mon Sep 17 00:00:00 2001 From: Jeremy Rudman Date: Sat, 18 Jul 2020 01:36:46 -0400 Subject: [PATCH 2/6] fix: houndci formatting errors --- app/views/manage/messages/show.html.haml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/manage/messages/show.html.haml b/app/views/manage/messages/show.html.haml index f2a546f6b..ce6bc1b97 100644 --- a/app/views/manage/messages/show.html.haml +++ b/app/views/manage/messages/show.html.haml @@ -10,17 +10,17 @@ - if recipient_error.present? %button.btn.btn-sm.btn-outline-secondary{disabled: 'disabled', title: 'Cannot deliver when there is a recipient error; see error above.'} Deliver - else - %button.btn.btn-sm.btn-primary{"data-toggle"=>"modal", "data-target"=>"#confirm_messages"} + %button.btn.btn-sm.btn-primary{"data-toggle"=>"modal", "data-target"=>"#confirmMessages"} %span.fa.fa-send.icon-space-r-half %span Send - .modal{:id => "confirm_messages"} + .modal{:id => "confirmMessages"} .modal-dialog{:role => "document"} .modal-content .modal-header %h5{:class => "modal-title"} Confirm .modal-body %p Are you sure? The message "#{@message.name}" will be sent to: - %p.center.font-weight-bold{:style => "color: red; font-size: 18px"} #{recipient_count} + %p.center.font-weight-bold{:style => "color: red; font-size: 18px"} = recipient_count .modal-footer %button.btn.btn-secondary{'data-dismiss'=>"modal"} Close = link_to deliver_manage_message_path(@message), method: :patch, class: 'btn btn-danger' do From a87619f3964facd3824231f89e7fff16e60bb790 Mon Sep 17 00:00:00 2001 From: Jeremy Rudman Date: Thu, 23 Jul 2020 04:14:54 -0400 Subject: [PATCH 3/6] 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 --- app/views/manage/messages/show.html.haml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/views/manage/messages/show.html.haml b/app/views/manage/messages/show.html.haml index ce6bc1b97..bce7c7ef8 100644 --- a/app/views/manage/messages/show.html.haml +++ b/app/views/manage/messages/show.html.haml @@ -1,6 +1,12 @@ :ruby begin recipient_count = pluralize(BulkMessageJob.build_recipients(@message.recipients).count, "Recipient") + number_of_recipients = BulkMessageJob.build_recipients(@message.recipients).count + recipient_plural = "Recipient" + if number_of_recipients > 1 + recipient_plural = "Recipients" + end + rescue => recipient_error end @@ -20,11 +26,13 @@ %h5{:class => "modal-title"} Confirm .modal-body %p Are you sure? The message "#{@message.name}" will be sent to: - %p.center.font-weight-bold{:style => "color: red; font-size: 18px"} = recipient_count + %p.center + %span.font-weight-bold{:style => "color: red; font-size: 18px"}= number_of_recipients + %span.font-weight-bold{:style => "font-size: 18px"}= recipient_plural .modal-footer %button.btn.btn-secondary{'data-dismiss'=>"modal"} Close = link_to deliver_manage_message_path(@message), method: :patch, class: 'btn btn-danger' do - %span Send Messages + %span Send Message - if @message.can_edit? = link_to 'Edit', edit_manage_message_path(@message), class: 'btn btn-sm btn-outline-secondary' = 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' From 5fee2f3dda0d8e30f262f1dab75ab9ac0d279a20 Mon Sep 17 00:00:00 2001 From: Jeremy Rudman Date: Thu, 23 Jul 2020 04:29:39 -0400 Subject: [PATCH 4/6] fix: houndci styling changes --- app/views/manage/messages/show.html.haml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/manage/messages/show.html.haml b/app/views/manage/messages/show.html.haml index bce7c7ef8..65d70278e 100644 --- a/app/views/manage/messages/show.html.haml +++ b/app/views/manage/messages/show.html.haml @@ -16,19 +16,19 @@ - if recipient_error.present? %button.btn.btn-sm.btn-outline-secondary{disabled: 'disabled', title: 'Cannot deliver when there is a recipient error; see error above.'} Deliver - else - %button.btn.btn-sm.btn-primary{"data-toggle"=>"modal", "data-target"=>"#confirmMessages"} + %button.btn.btn-sm.btn-primary{"data-toggle"=>"modal", "data-target"=>"#confirm-messages"} %span.fa.fa-send.icon-space-r-half %span Send - .modal{:id => "confirmMessages"} + .modal{:id => "confirm-messages"} .modal-dialog{:role => "document"} .modal-content .modal-header %h5{:class => "modal-title"} Confirm .modal-body %p Are you sure? The message "#{@message.name}" will be sent to: - %p.center - %span.font-weight-bold{:style => "color: red; font-size: 18px"}= number_of_recipients - %span.font-weight-bold{:style => "font-size: 18px"}= recipient_plural + %h3.center + %span.font-weight-bold.text-danger= number_of_recipients + %span= recipient_plural .modal-footer %button.btn.btn-secondary{'data-dismiss'=>"modal"} Close = link_to deliver_manage_message_path(@message), method: :patch, class: 'btn btn-danger' do From 9a8b0e1a218df72a02659455a8c71299fa064e15 Mon Sep 17 00:00:00 2001 From: Jeremy Rudman Date: Thu, 23 Jul 2020 19:41:37 -0400 Subject: [PATCH 5/6] feat: made email modal text black instead of red the email confirmation modal displays the number in black instead of red --- app/views/manage/messages/show.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/manage/messages/show.html.haml b/app/views/manage/messages/show.html.haml index 65d70278e..0d1a32935 100644 --- a/app/views/manage/messages/show.html.haml +++ b/app/views/manage/messages/show.html.haml @@ -27,7 +27,7 @@ .modal-body %p Are you sure? The message "#{@message.name}" will be sent to: %h3.center - %span.font-weight-bold.text-danger= number_of_recipients + %span.font-weight-bold= number_of_recipients %span= recipient_plural .modal-footer %button.btn.btn-secondary{'data-dismiss'=>"modal"} Close From e8f8419b6b3822ac1dc186e27b4d7eeab13eea80 Mon Sep 17 00:00:00 2001 From: "Chris Baudouin, Jr" Date: Sat, 25 Jul 2020 12:41:24 -0400 Subject: [PATCH 6/6] refactor: Adds number delimiter to recipients, changes cancel outline --- app/views/manage/messages/show.html.haml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/views/manage/messages/show.html.haml b/app/views/manage/messages/show.html.haml index 0d1a32935..b205d9014 100644 --- a/app/views/manage/messages/show.html.haml +++ b/app/views/manage/messages/show.html.haml @@ -27,10 +27,12 @@ .modal-body %p Are you sure? The message "#{@message.name}" will be sent to: %h3.center - %span.font-weight-bold= number_of_recipients - %span= recipient_plural + %span.font-weight-bold + = number_with_delimiter(number_of_recipients) + %span + = recipient_plural .modal-footer - %button.btn.btn-secondary{'data-dismiss'=>"modal"} Close + %button.btn.btn-outline-secondary{'data-dismiss'=>"modal"} Close = link_to deliver_manage_message_path(@message), method: :patch, class: 'btn btn-danger' do %span Send Message - if @message.can_edit?