controllers: move /moderator/post/disapprovals to /post_disapprovals.

This commit is contained in:
evazion
2020-02-15 07:08:44 -06:00
parent 60ff2ae929
commit a214989447
11 changed files with 77 additions and 89 deletions

View File

@@ -1,7 +1,7 @@
<div id="detailed-rejection-dialog" title="Detailed Rejection" style="display: none;">
<p>You can supply a short message to the uploader explaining why you rejected this upload.</p>
<%= edit_form_for(PostDisapproval.new, url: moderator_post_disapprovals_path, remote: true, html: { id: "detailed-rejection-form" }) do |f| %>
<%= edit_form_for(PostDisapproval.new, url: post_disapprovals_path, remote: true, html: { id: "detailed-rejection-form" }) do |f| %>
<%= f.hidden_field :post_id, value: "x" %>
<%= f.input :reason, collection: [["Breaks Rules", "breaks_rules"], ["Poor Quality", "poor_quality"], ["No interest", "disinterest"]] %>
<%= f.input :message, as: :string %>

View File

@@ -0,0 +1,11 @@
<% if @post_disapproval.errors.any? %>
Danbooru.error("Error: " + <%= @post_disapproval.errors.full_messages.join("; ").to_json.html_safe %>);
<% else %>
if ($("#c-posts #a-show").length) {
location.reload();
} else if ($("#c-moderator-post-queues").length) {
$("#c-moderator-post-queues #post-<%= @post_disapproval.post.id %>").hide();
$(window).trigger("danbooru:modqueue_increment_processed");
Danbooru.notice("Post was hidden");
}
<% end %>

View File

@@ -0,0 +1,40 @@
<div id="c-post-disapprovals">
<div id="a-index">
<h1>Disapprovals</h1>
<%= search_form_for(post_disapprovals_path) do |f| %>
<%= f.input :user_name, label: "Creator", input_html: { value: params[:search][:user_name] } %>
<%= f.input :post_id, label: "Post ID", input_html: { value: params[:search][:post_id] } %>
<%= f.input :post_tags_match, label: "Tags", input_html: { value: params[:search][:post_tags_match], data: { autocomplete: "tag-query" } } %>
<%= f.input :message_matches, label: "Message", input_html: { value: params[:search][:message_matches] } %>
<%= f.input :reason, label: "Reason", collection: %w[breaks_rules disinterest poor_quality].map { |x| [x.humanize, x] }, include_blank: true, selected: params[:search][:reason] %>
<%= f.input :has_message, label: "Has Message?", collection: %w[Yes No], include_blank: true, selected: params[:search][:has_message] %>
<%= f.input :order, collection: [["ID", "id_desc"], ["Post ID", "post_id_desc"]], selected: params[:search][:order] %>
<%= f.submit "Search" %>
<% end %>
<%= table_for @post_disapprovals, {class: "striped autofit", width: "100%"} do |t| %>
<% t.column "Post" do |post_disapproval| %>
<%= link_to "post ##{post_disapproval.post_id}", post_path(post_disapproval.post_id) %>
<%= link_to "»", post_disapprovals_path(search: params[:search].merge(post_id: post_disapproval.post_id)) %>
<% end %>
<% t.column "Message", td: {class: "col-expand"} do |post_disapproval| %>
<div class="prose">
<%= format_text(post_disapproval.message) %>
</div>
<% end %>
<% t.column "Reason" do |post_disapproval| %>
<%= link_to post_disapproval.reason.humanize, post_disapprovals_path(search: params[:search].merge(reason: post_disapproval.reason)) %>
<% end %>
<% t.column "Created" do |post_disapproval| %>
<%= link_to_user post_disapproval.user %>
<%= link_to "»", post_disapprovals_path(search: params[:search].merge(creator_name: post_disapproval.user&.name)) %>
<p>
<%= compact_time(post_disapproval.updated_at) %>
</p>
<% end %>
<% end %>
<%= numbered_paginator(@post_disapprovals) %>
</div>
</div>