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.
This commit is contained in:
Jacob Herrington 2020-02-20 12:44:03 -06:00 committed by GitHub
parent dabeb1c732
commit a24a37c7a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -91,9 +91,16 @@
</span>
<span>
<% 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 %>