Merge pull request #5114 from nonamethanks/editable-post-disapprovals
Allow post disapprovals to be edited
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
<div class="quick-mod">
|
||||
<%= link_to_if post.is_approvable?, "Approve", post_approvals_path(post_id: post.id), method: :post, remote: true, class: "approve-link btn" %> |
|
||||
<%= link_to "Breaks Rules", post_disapprovals_path(post_disapproval: { post_id: post.id, reason: "breaks_rules" }), method: :post, remote: true, class: "disapprove-link btn" %> |
|
||||
<%= link_to "Poor Quality", post_disapprovals_path(post_disapproval: { post_id: post.id, reason: "poor_quality" }), method: :post, remote: true, class: "disapprove-link btn" %> |
|
||||
<%= link_to "No Interest", post_disapprovals_path(post_disapproval: { post_id: post.id, reason: "disinterest" }), method: :post, remote: true, class: "disapprove-link btn" %> |
|
||||
<% PostDisapproval::REASONS.each do |reason| %>
|
||||
<% if @previous_disapproval&.reason == reason %>
|
||||
<%= reason.humanize %> |
|
||||
<% elsif @previous_disapproval %>
|
||||
<%= link_to reason.humanize, post_disapproval_path(@previous_disapproval, post_disapproval: { reason: reason }), method: :put, remote: true, class: "disapprove-link disapprove-link-#{reason.gsub("_", "-")} btn" %> |
|
||||
<% else %>
|
||||
<%= link_to reason.humanize, post_disapprovals_path(post_disapproval: { post_id: post.id, reason: reason }), method: :post, remote: true, class: "disapprove-link disapprove-link-#{reason.gsub("_", "-")} btn" %> |
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%= link_to "Detailed Rejection", "#", "data-post-id" => post.id, class: "detailed-rejection-link btn" %>
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
<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: post_disapprovals_path, remote: true, html: { id: "detailed-rejection-form" }) do |f| %>
|
||||
<%= f.hidden_field :post_id, value: "x" %>
|
||||
<%= f.input :reason, collection: PostDisapproval::REASONS.map { |x| [x.humanize, x] } %>
|
||||
<%= f.input :message, as: :string %>
|
||||
<% if @previous_disapproval %>
|
||||
<%= edit_form_for(@previous_disapproval, remote: true, html: { id: "detailed-rejection-form" }) do |f| %>
|
||||
<%= f.input :reason, collection: PostDisapproval::REASONS.map { |x| [x.humanize, x] }, :selected => @previous_disapproval.reason %>
|
||||
<%= f.input :message, as: :string, :input_html => {:value => @previous_disapproval.message } %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= edit_form_for(PostDisapproval.new, remote: true, html: { id: "detailed-rejection-form" }) do |f| %>
|
||||
<%= f.hidden_field :post_id, value: "x" %>
|
||||
<%= f.input :reason, collection: PostDisapproval::REASONS.map { |x| [x.humanize, x] } %>
|
||||
<%= f.input :message, as: :string %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
1
app/views/post_disapprovals/update.js.erb
Normal file
1
app/views/post_disapprovals/update.js.erb
Normal file
@@ -0,0 +1 @@
|
||||
location.reload();
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
<%= render "post_disapprovals/counts", disapprovals: post.disapprovals.order(id: :asc), post: post %>
|
||||
|
||||
<% if policy(PostDisapproval).create? && !post.disapproved_by?(CurrentUser.user) %>
|
||||
<% if CurrentUser.user.is_approver? %>
|
||||
<%= render "modqueue/quick_mod", post: post %>
|
||||
<%= render "post_disapprovals/detailed_rejection_dialog" %>
|
||||
<% end %>
|
||||
|
||||
@@ -51,11 +51,6 @@
|
||||
<% end %>
|
||||
|
||||
<% if policy(PostApproval).create? %>
|
||||
<% if post.is_approvable? %>
|
||||
<li id="post-option-approve"><%= link_to (post.is_deleted? ? "Undelete" : "Approve"), post_approvals_path(post_id: post.id), remote: true, method: :post, "data-shortcut": "shift+o", "data-confirm": "Are you sure you want to approve this post?" %></li>
|
||||
<li id="post-option-disapprove"><%= link_to "Hide from queue", post_disapprovals_path(post_disapproval: { post_id: post.id, reason: "disinterest" }), remote: true, method: :post %></li>
|
||||
<% end %>
|
||||
|
||||
<% if post.is_deleted? && policy(post).move_favorites? %>
|
||||
<li id="post-option-move-favorites"><%= link_to "Move favorites", confirm_move_favorites_moderator_post_post_path(post_id: post.id) %></li>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user