From 36881f83c74a12b754ef4e5c9b1781e6d39dc2a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=A3is=20Ozols?= Date: Fri, 6 Jul 2012 15:13:50 +0300 Subject: Split rejected and approved comment actions into separate controller actions. --- .../refinery/blog/admin/comments_controller.rb | 36 +++++++++++----------- 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'app/controllers/refinery/blog') diff --git a/app/controllers/refinery/blog/admin/comments_controller.rb b/app/controllers/refinery/blog/admin/comments_controller.rb index 18246ee..ce4ac70 100644 --- a/app/controllers/refinery/blog/admin/comments_controller.rb +++ b/app/controllers/refinery/blog/admin/comments_controller.rb @@ -16,31 +16,31 @@ module Refinery end def approved - unless params[:id].present? - @comments = Refinery::Blog::Comment.approved.page(params[:page]) + @comments = Refinery::Blog::Comment.approved.page(params[:page]) - render :index - else - @comment = Refinery::Blog::Comment.find(params[:id]) - @comment.approve! - flash[:notice] = t('approved', :scope => 'refinery.blog.admin.comments', :author => @comment.name) + render :index + end + + def approve + @comment = Refinery::Blog::Comment.find(params[:id]) + @comment.approve! + flash[:notice] = t('approved', :scope => 'refinery.blog.admin.comments', :author => @comment.name) - redirect_to refinery.url_for(:action => params[:return_to] || 'index', :id => nil) - end + redirect_to refinery.blog_admin_comments_path end def rejected - unless params[:id].present? - @comments = Refinery::Blog::Comment.rejected.page(params[:page]) + @comments = Refinery::Blog::Comment.rejected.page(params[:page]) + + render :index + end - render :index - else - @comment = Refinery::Blog::Comment.find(params[:id]) - @comment.reject! - flash[:notice] = t('rejected', :scope => 'refinery.blog.admin.comments', :author => @comment.name) + def reject + @comment = Refinery::Blog::Comment.find(params[:id]) + @comment.reject! + flash[:notice] = t('rejected', :scope => 'refinery.blog.admin.comments', :author => @comment.name) - redirect_to refinery.url_for(:action => params[:return_to] || 'index', :id => nil) - end + redirect_to refinery.blog_admin_comments_path end end -- cgit v1.2.3