Class: Admin::Blog::CommentsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/admin/blog/comments_controller.rb

Overview

@Name: Admin Blog Comments controller @Purpose: Creating , modifying, deleting blog comments for the cms @Created date: 08-06-2012 @Modified Date: 12-06-2012

@Company  : Mindfire Solutions

Instance Method Summary collapse

Instance Method Details

#approvedObject

approving comments if there is a request to approve comment showing all approved comments when params is not present



36
37
38
39
40
41
42
43
44
45
46
# File 'app/controllers/admin/blog/comments_controller.rb', line 36

def approved
  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

#indexObject

showing all comments where state are nil



29
30
31
32
# File 'app/controllers/admin/blog/comments_controller.rb', line 29

def index
  @blog_comments = BlogComment.unmoderated
  render :action => 'index'
end

#rejectedObject

rejecting comments if there is a request to reject comment showing all rejected comments when params is not present



50
51
52
53
54
55
56
57
58
59
60
# File 'app/controllers/admin/blog/comments_controller.rb', line 50

def rejected
  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