From 5c71c0aaa5c96683b56d2d8af0dfdac8424e41d2 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Thu, 2 Sep 2010 17:49:11 +1200 Subject: Comment moderation now working in the backend. Of course it still happens automatically if the blog isn't moderated based on whether it's spam or not. --- app/controllers/admin/blog/comments_controller.rb | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'app/controllers/admin/blog') diff --git a/app/controllers/admin/blog/comments_controller.rb b/app/controllers/admin/blog/comments_controller.rb index 33b3463..709d86d 100644 --- a/app/controllers/admin/blog/comments_controller.rb +++ b/app/controllers/admin/blog/comments_controller.rb @@ -10,13 +10,27 @@ class Admin::Blog::CommentsController < Admin::BaseController end def approved - @blog_comments = BlogComment.approved - render :action => 'index' + unless params[:id].present? + @blog_comments = BlogComment.approved + render :action => 'index' + else + @blog_comment = BlogComment.find(params[:id]) + @blog_comment.approve! + flash[:notice] = t('admin.blog.comments.approved', :author => @blog_comment.name) + redirect_to :action => params[:return_to] || 'index' + end end def rejected - @blog_comments = BlogComment.rejected - render :action => 'index' + unless params[:id].present? + @blog_comments = BlogComment.rejected + render :action => 'index' + else + @blog_comment = BlogComment.find(params[:id]) + @blog_comment.reject! + flash[:notice] = t('admin.blog.comments.rejected', :author => @blog_comment.name) + redirect_to :action => params[:return_to] || 'index' + end end end -- cgit v1.2.3