Class: Admin::Whatson::CommentsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/admin/whatson/comments_controller.rb

Instance Method Summary collapse

Instance Method Details

#approvedObject



14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/admin/whatson/comments_controller.rb', line 14

def approved
  unless params[:id].present?
    @whatson_comments = WhatsonComment.approved
    render :action => 'index'
  else
    @whatson_comment = WhatsonComment.find(params[:id])
    @whatson_comment.approve!
    flash[:notice] = t('approved', :scope => 'admin.whatson.comments', :author => @whatson_comment.name)
    redirect_to :action => params[:return_to] || 'index'
  end
end

#indexObject



9
10
11
12
# File 'app/controllers/admin/whatson/comments_controller.rb', line 9

def index
  @whatson_comments = WhatsonComment.unmoderated
  render :action => 'index'
end

#rejectedObject



26
27
28
29
30
31
32
33
34
35
36
# File 'app/controllers/admin/whatson/comments_controller.rb', line 26

def rejected
  unless params[:id].present?
    @whatson_comments = WhatsonComment.rejected
    render :action => 'index'
  else
    @whatson_comment = WhatsonComment.find(params[:id])
    @whatson_comment.reject!
    flash[:notice] = t('rejected', :scope => 'admin.whatson.comments', :author => @whatson_comment.name)
    redirect_to :action => params[:return_to] || 'index'
  end
end