refactored post mod queue

This commit is contained in:
albert
2011-07-22 13:35:40 -04:00
parent e06e17c4ba
commit 4828cef27d
18 changed files with 233 additions and 71 deletions

View File

@@ -0,0 +1,10 @@
module Moderator
module Post
class ApprovalsController < ApplicationController
def create
@post = ::Post.find(params[:post_id])
@post.approve!
end
end
end
end

View File

@@ -0,0 +1,13 @@
module Moderator
module Post
class DashboardsController < ApplicationController
respond_to :html, :json
def show
@search = ::Post.order("id asc").pending_or_flagged.available_for_moderation.search(:tag_match => params[:query])
@posts = @search.paginate(params[:page])
respond_with(@posts)
end
end
end
end

View File

@@ -0,0 +1,15 @@
module Moderator
module Post
class DisapprovalsController < ApplicationController
def create
@post = ::Post.find(params[:post_id])
@post_disapproval = PostDisapproval.create(:post => @post, :user => CurrentUser.user)
if @post_disapproval.errors.any?
raise ::Post::DisapprovalError.new(@post_disapproval.errors.full_messages)
end
# js: redirect to dashboard
end
end
end
end

View File

@@ -0,0 +1,15 @@
module Moderator
module Post
class PostsController < ApplicationController
def delete
@post = ::Post.find(params[:id])
@post.delete!
end
def undelete
@post = ::Post.find(params[:id])
@post.undelete!
end
end
end
end