cirandas.net

ref: master

plugins/comment_classification/controllers/comment_classification_plugin_myprofile_controller.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class CommentClassificationPluginMyprofileController < MyProfileController
  append_view_path File.join(File.dirname(__FILE__) + '/../views')

  before_filter :organizations_only
  protect 'moderate_comments', :profile

  def index
    @comments = Comment.all
  end

  def add_status
    @comment = Comment.find(params[:id])
    @statuses = CommentClassificationPlugin::Status.enabled
    @status = CommentClassificationPlugin::CommentStatusUser.new(:profile => user, :comment => @comment)
    if request.post? && params[:status]
      @status.update(params[:status])
      @status.save
    end
  end

  private

  def organizations_only
    render_not_found if !profile.organization?
  end
end