cirandas.net

ref: master

plugins/comment_paragraph/controllers/myprofile/comment_paragraph_plugin_myprofile_controller.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
class CommentParagraphPluginMyprofileController < MyProfileController

  before_filter :check_permission

  def toggle_activation
    @article.comment_paragraph_plugin_activate = !@article.comment_paragraph_plugin_activate
    @article.save!
    redirect_to @article.view_url
  end

  protected

  def check_permission
    @article = profile.articles.find(params[:id])
    render_access_denied unless @article.comment_paragraph_plugin_enabled? && @article.allow_edit?(user)
  end

end