* Fix routing error in respond_with (didn't use /moderator namespace). * Fix /moderator/posts/approvals.json response to return full PostApproval object, not just a success/failure message. * Simplify the javascript a bit (use $.post instead of $.ajax).
17 lines
413 B
Ruby
17 lines
413 B
Ruby
module Moderator
|
|
module Post
|
|
class ApprovalsController < ApplicationController
|
|
before_filter :approver_only
|
|
skip_before_filter :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
|