delete action from post/show requires confirmation+flag reason now

This commit is contained in:
albert
2013-02-23 16:53:03 -05:00
parent 138f3eb3db
commit 4a61498f0e
5 changed files with 27 additions and 7 deletions

View File

@@ -3,10 +3,18 @@ module Moderator
class PostsController < ApplicationController
before_filter :janitor_only, :only => [:delete, :undelete]
before_filter :admin_only, :only => [:annihilate]
def confirm_delete
@post = ::Post.find(params[:id])
end
def delete
@post = ::Post.find(params[:id])
@post.delete!
if params[:commit] == "Delete"
@post.flag!(params[:reason])
@post.delete!
end
redirect_to(post_path(@post))
end
def undelete