aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/refinery/admin/blog/comments_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/refinery/admin/blog/comments_controller.rb')
-rw-r--r--app/controllers/refinery/admin/blog/comments_controller.rb42
1 files changed, 42 insertions, 0 deletions
diff --git a/app/controllers/refinery/admin/blog/comments_controller.rb b/app/controllers/refinery/admin/blog/comments_controller.rb
new file mode 100644
index 0000000..9f78caa
--- /dev/null
+++ b/app/controllers/refinery/admin/blog/comments_controller.rb
@@ -0,0 +1,42 @@
+module Refinery
+ module Admin
+ module Blog
+ class CommentsController < ::Admin::BaseController
+
+ crudify :'refinery/blog_comment',
+ :title_attribute => :name,
+ :order => 'published_at DESC'
+
+ def index
+ @blog_comments = Refinery::BlogComment.unmoderated
+ render :action => 'index'
+ end
+
+ def approved
+ unless params[:id].present?
+ @blog_comments = Refinery::BlogComment.approved
+ render :action => 'index'
+ else
+ @blog_comment = Refinery::BlogComment.find(params[:id])
+ @blog_comment.approve!
+ flash[:notice] = t('approved', :scope => 'admin.blog.comments', :author => @blog_comment.name)
+ redirect_to :action => params[:return_to] || 'index'
+ end
+ end
+
+ def rejected
+ unless params[:id].present?
+ @blog_comments = Refinery::BlogComment.rejected
+ render :action => 'index'
+ else
+ @blog_comment = Refinery::BlogComment.find(params[:id])
+ @blog_comment.reject!
+ flash[:notice] = t('rejected', :scope => 'admin.blog.comments', :author => @blog_comment.name)
+ redirect_to :action => params[:return_to] || 'index'
+ end
+ end
+
+ end
+ end
+ end
+end