From a24a37c7a6ee5fc010ec49f513d7e14bf63e81b7 Mon Sep 17 00:00:00 2001 From: Jacob Herrington Date: Thu, 20 Feb 2020 12:44:03 -0600 Subject: [PATCH] Add JS confirm to confirmation of user vomits (#6211) Because confirming a User vomit is a particularly destructive task, we want to make it a bit more intentional. Ben recommended adding a confirm dialog for these reports. This commit also satisfies erblint's complaints regarding the select element in the ransack search form. --- .../internal/feedback_messages/index.html.erb | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/app/views/internal/feedback_messages/index.html.erb b/app/views/internal/feedback_messages/index.html.erb index 724995355..d5a0d9ef9 100644 --- a/app/views/internal/feedback_messages/index.html.erb +++ b/app/views/internal/feedback_messages/index.html.erb @@ -91,9 +91,16 @@ <% if params[:status] == "Open" || params[:status].blank? %> - <%= form_for [:internal, reaction], html: { class: "d-inline" } do |f| %> - <%= f.hidden_field :status, value: "confirmed" %> - <%= f.submit "CONFIRMED", class: "btn btn-success btn-sm" %> + <% if reaction.reactable_type == "User" %> + <%= form_for [:internal, reaction], html: { class: "d-inline" } do |f| %> + <%= f.hidden_field :status, value: "confirmed" %> + <%= f.submit "CONFIRMED", class: "btn btn-success btn-sm", data: { confirm: "Are you sure?" } %> + <% end %> + <% else %> + <%= form_for [:internal, reaction], html: { class: "d-inline" } do |f| %> + <%= f.hidden_field :status, value: "confirmed" %> + <%= f.submit "CONFIRMED", class: "btn btn-success btn-sm" %> + <% end %> <% end %> <%= form_for [:internal, reaction], html: { class: "d-inline" } do |f| %> <%= f.hidden_field :status, value: "invalid" %> @@ -117,14 +124,12 @@ <%= f.label :reporter_username_cont, "Reporter", class: "sr-only" %> <%= f.search_field :reporter_username_cont, placeholder: "Reporter", class: "form-control mx-3" %> - <%= f.select :status_eq, - options_for_select([ - ["Open"], - ["Invalid"], - ["Resolved"], - ], @q.status_eq), - {}, - class: "custom-select mx-3" %> + <%= f.select( + :status_eq, + options_for_select([["Open"], ["Invalid"], ["Resolved"]], @q.status_eq), + {}, + class: "custom-select mx-3", + ) %> <%= f.submit "Search", class: "btn btn-secondary" %> <% end %>