Class: Gluttonberg::Admin::Content::CommentsController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- BaseController
- Gluttonberg::Admin::Content::CommentsController
- Includes:
- ActionView::Helpers::TextHelper
- Defined in:
- app/controllers/gluttonberg/admin/content/comments_controller.rb
Instance Method Summary collapse
- #approved ⇒ Object
- #block_comment_author ⇒ Object
- #delete ⇒ Object
- #destroy ⇒ Object
- #index ⇒ Object
- #moderation ⇒ Object
- #pending ⇒ Object
- #rejected ⇒ Object
- #spam ⇒ Object
- #spam_detection_for_all_pending ⇒ Object
Instance Method Details
#approved ⇒ Object
55 56 57 58 |
# File 'app/controllers/gluttonberg/admin/content/comments_controller.rb', line 55 def approved @comments = Comment.all_approved.order("created_at DESC").paginate(:per_page => Gluttonberg::Setting.get_setting("number_of_per_page_items"), :page => params[:page] , :order => "created_at DESC") render :template => "/gluttonberg/admin/content/comments/index" end |
#block_comment_author ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'app/controllers/gluttonberg/admin/content/comments_controller.rb', line 75 def @comment = Comment.find(params[:id]) = "" unless @comment..blank? || @comment. == "NULL" || @comment..length < 3 += @comment. end unless @comment..blank? || @comment. == "NULL" || @comment..length < 3 += ", " unless .blank? += @comment. end unless @comment..blank? || @comment. == "NULL" || @comment..length < 3 += ", " unless .blank? += @comment. end unless .blank? gb_blacklist_settings = Gluttonberg::Setting.get_setting("comment_blacklist") if gb_blacklist_settings.blank? gb_blacklist_settings = else gb_blacklist_settings = gb_blacklist_settings + ", " + end Gluttonberg::Setting.update_settings("comment_blacklist" => gb_blacklist_settings) Comment.spam_detection_for_all end redirect_to admin_pending_comments_path end |
#delete ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/gluttonberg/admin/content/comments_controller.rb', line 19 def delete @comment = Comment.find(params[:id]) display_delete_confirmation( :title => "Delete Comment ?", :url => admin_comment_destroy_path(@comment), :return_url => :back, :warning => "" ) end |
#destroy ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'app/controllers/gluttonberg/admin/content/comments_controller.rb', line 37 def destroy @comment = Comment.find(params[:id]) if @comment.delete flash[:notice] = "The comment was successfully deleted." Gluttonberg::Feed.log(current_user,@comment, truncate(@comment.body, :length => 100) , "deleted") redirect_to admin_pending_comments_path() else flash[:error] = "There was an error deleting the comment." redirect_to admin_pending_comments_path() end end |
#index ⇒ Object
14 15 16 17 |
# File 'app/controllers/gluttonberg/admin/content/comments_controller.rb', line 14 def index find_article([:comments]) @comments = @article.comments.order("created_at DESC").paginate(:per_page => Gluttonberg::Setting.get_setting("number_of_per_page_items"), :page => params[:page] , :order => "created_at DESC") end |
#moderation ⇒ Object
29 30 31 32 33 34 35 |
# File 'app/controllers/gluttonberg/admin/content/comments_controller.rb', line 29 def moderation @comment = Comment.find(params[:id]) @comment.moderate(params[:moderation]) Gluttonberg::Feed.log(current_user,@comment, truncate(@comment.body, :length => 100) , params[:moderation]) redirect_to :back end |
#pending ⇒ Object
50 51 52 53 |
# File 'app/controllers/gluttonberg/admin/content/comments_controller.rb', line 50 def pending @comments = Comment.all_pending.order("created_at DESC").paginate(:per_page => Gluttonberg::Setting.get_setting("number_of_per_page_items"), :page => params[:page] , :order => "created_at DESC") render :template => "/gluttonberg/admin/content/comments/index" end |
#rejected ⇒ Object
60 61 62 63 |
# File 'app/controllers/gluttonberg/admin/content/comments_controller.rb', line 60 def rejected @comments = Comment.all_rejected.order("created_at DESC").paginate(:per_page => Gluttonberg::Setting.get_setting("number_of_per_page_items"), :page => params[:page] , :order => "created_at DESC") render :template => "/gluttonberg/admin/content/comments/index" end |
#spam ⇒ Object
65 66 67 68 |
# File 'app/controllers/gluttonberg/admin/content/comments_controller.rb', line 65 def spam @comments = Comment.all_spam.order("created_at DESC").paginate(:per_page => Gluttonberg::Setting.get_setting("number_of_per_page_items"), :page => params[:page] , :order => "created_at DESC") render :template => "/gluttonberg/admin/content/comments/index" end |
#spam_detection_for_all_pending ⇒ Object
70 71 72 73 |
# File 'app/controllers/gluttonberg/admin/content/comments_controller.rb', line 70 def spam_detection_for_all_pending Comment.spam_detection_for_all redirect_to admin_pending_comments_path end |