docbrown/app/views/admin/feedback_messages/_abuse_reports.html.erb
Julianna Tetreault 09c3c25bf8
Add Options to "Invalidate" and "Mark as Valid" Vomit Reactions (#9769) [deploy]
* Adds valid status to the feedback_message model and a spec to validate the status

* Adds an unresolve button to resolved vomits in _abuse_reports.html.erb

* Adds functions to update valid status in reaction_controller.js

* Use invalidate in place of unresolve for unconfirming vomit button

* Add option to reopen vomit reactions marked as invalid and invalidate resolved vomits
  - Adds a Reopen button under the invalid tab
  - Adds confirmedStatus JS to reaction_controller.js
  - Adds conditional to _abuse_reports.html.erb
2020-08-18 11:48:23 -06:00

102 lines
4.5 KiB
Text

<h2>Abuse Reports</h2>
<div class="row my-3">
<div class="col">
<ul class="nav nav-pills">
<li class="nav-item">
<a href="<%= admin_reports_path(state: @feedback_type, status: "Open") %>" class="nav-link <%= "active" if @status == "Open" %>">Open/Unresolved</a>
</li>
<li class="nav-item">
<a href="<%= admin_reports_path(state: @feedback_type, status: "Resolved") %>" class="nav-link <%= "active" if @status == "Resolved" %>">Resolved</a>
</li>
<li class="nav-item">
<a href="<%= admin_reports_path(state: @feedback_type, status: "Invalid") %>" class="nav-link <%= "active" if @status == "Invalid" %>">Invalid</a>
</ul>
</div>
</div>
<div class="row my-3" id="vomitReactions">
<div class="card w-100">
<div class="card-header" id="vomitReactionsHeader">
<h2 class="d-inline">Vomit Reactions</h2>
<button class="btn btn-secondary float-right" type="button" data-toggle="collapse" data-target="#vomitReactionsBodyContainer" aria-expanded="false" aria-controls="vomitReactionsBodyContainer">
Toggle
</button>
</div>
<div id="vomitReactionsBodyContainer" class="collapse hide" aria-labelledby="vomitReactionsHeader" data-parent="#vomitReactions">
<div class="card-body" style="overflow: scroll; max-height: 500px;">
<% @vomits.each do |reaction| %>
<% next if (reaction.reactable_type == "Article" && !reaction.reactable.published) || (reaction.reactable_type == "User" && reaction.reactable&.banished?) %>
<div class="d-flex justify-content-between" data-controller="reaction" data-reaction-id="<%= reaction.id %>">
<span>
🤢 <a href="<%= reaction.user.path %>">@<%= reaction.user.username %></a>
</span>
<span>
<strong><%= reaction.reactable_type %>:</strong>
<a href="<%= reaction.reactable.path %>"><%= reaction.reactable_type == "User" ? reaction.reactable.username : reaction.reactable.title %></a>
<% if reaction.reactable_type == "User" && reaction.reactable.banned %>
<span class="badge badge-danger">Suspended</span>
<% end %>
<% if reaction.reactable_type == "User" && reaction.reactable.vomitted_on? %>
<span class="badge badge-warning">Vomitted</span>
<% end %>
</span>
<span>
<% if params[:status] == "Open" || params[:status].blank? %>
<% if reaction.reactable_type == "User" %>
<button
class="btn btn-success btn-sm"
type="button"
data-reactable="user"
data-status="confirmed"
data-target="reaction.confirmed"
data-action="reaction#reactableUserCheck">
CONFIRM
</button>
<% else %>
<button
class="btn btn-success btn-sm"
type="button"
data-reactable="non-user"
data-status="confirmed"
data-target="reaction.confirmed"
data-action="reaction#reactableUserCheck">
CONFIRM
</button>
<% end %>
<button
class="btn btn-danger btn-sm"
type="button"
data-altstatus="invalid"
data-target="reaction.invalid"
data-action="reaction#updateReactionInvalid">
INVALID
</button>
<% end %>
<% if params[:status] == "Resolved" %>
<button
class="btn btn-warning text-white btn-sm"
type="button"
data-altstatus="invalid"
data-target="reaction.invalid"
data-action="reaction#updateReactionInvalid">
INVALIDATE
</button>
<% elsif params[:status] == "Invalid" %>
<button
class="btn btn-success btn-sm"
type="button"
data-status="confirmed"
data-target="reaction.confirmed"
data-action="reaction#updateReactionConfirmed">
MARK AS VALID
</button>
<% end %>
</span>
</div>
<hr id="js__reaction__div__hr__<%= reaction.id %>">
<% end %>
</div>
</div>
</div>
</div>