approvals: move post approval endpoint to /post_approvals.
Move the post approval endpoint from `POST /moderator/post/approval` to `POST /post_approvals`.
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
module Moderator
|
||||
module Post
|
||||
class ApprovalsController < ApplicationController
|
||||
before_action :approver_only
|
||||
skip_before_action :api_check
|
||||
respond_to :json, :xml, :js
|
||||
|
||||
def create
|
||||
cookies.permanent[:moderated] = Time.now.to_i
|
||||
post = ::Post.find(params[:post_id])
|
||||
@approval = post.approve!
|
||||
respond_with(:moderator, @approval)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,5 +1,13 @@
|
||||
class PostApprovalsController < ApplicationController
|
||||
respond_to :html, :xml, :json
|
||||
before_action :approver_only, only: [:create]
|
||||
respond_to :html, :xml, :json, :js
|
||||
|
||||
def create
|
||||
cookies.permanent[:moderated] = Time.now.to_i
|
||||
post = Post.find(params[:post_id])
|
||||
@approval = post.approve!
|
||||
respond_with(@approval)
|
||||
end
|
||||
|
||||
def index
|
||||
@post_approvals = PostApproval.paginated_search(params)
|
||||
|
||||
@@ -523,7 +523,7 @@ Post.update = function(post_id, params) {
|
||||
|
||||
Post.approve = function(post_id) {
|
||||
$.post(
|
||||
"/moderator/post/approval.json",
|
||||
"/post_approvals.json",
|
||||
{"post_id": post_id}
|
||||
).fail(function(data) {
|
||||
var message = $.map(data.responseJSON.errors, function(msg, attr) { return msg; }).join("; ");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class="quick-mod">
|
||||
<%= link_to_if post.is_approvable?, "Approve", moderator_post_approval_path(post_id: post.id), method: :post, remote: true, class: "approve-link btn" %> |
|
||||
<%= 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" %> |
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<% end %>
|
||||
|
||||
<% if post.is_approvable? && !post.is_deleted? %>
|
||||
<li id="post-option-approve"><%= link_to "Approve", moderator_post_approval_path(post_id: post.id), remote: true, method: :post, id: "approve", "data-shortcut": "shift+o", "data-confirm": "Are you sure you want to approve this post?" %></li>
|
||||
<li id="post-option-approve"><%= link_to "Approve", post_approvals_path(post_id: post.id), remote: true, method: :post, id: "approve", "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, id: "disapprove" %></li>
|
||||
<% end %>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user