app/controllers/comments_controller.rb in tkh_content-0.3.1 vs app/controllers/comments_controller.rb in tkh_content-0.4.2

- old
+ new

@@ -1,12 +1,12 @@ class CommentsController < ApplicationController - before_filter :authenticate - before_filter :authenticate_with_admin, :except => 'create' + before_filter :authenticate, :except => ['for_feed'] + before_filter :authenticate_with_admin, :except => ['create', 'for_feed'] def index - @comments = Comment.by_recent + @comments = Comment.by_recent.paginate(:page => params[:page], :per_page => 50) switch_to_admin_layout end # comments are shown within a page # new comments are created by users from within a page @@ -62,20 +62,28 @@ redirect_to comments_path, warning: t('comments.moderation.block.warning') end end def pending - @comments = Comment.pending + @comments = Comment.pending.by_created.paginate(:page => params[:page], :per_page => 50) switch_to_admin_layout end def accepted - @comments = Comment.accepted.by_recent + @comments = Comment.accepted.by_recent.paginate(:page => params[:page], :per_page => 50) switch_to_admin_layout end def blocked - @comments = Comment.blocked.by_recent + @comments = Comment.blocked.by_recent.paginate(:page => params[:page], :per_page => 50) switch_to_admin_layout + end + + def for_feed + @comments = Comment.showable.for_locale(I18n.locale).by_recently_created.limit(50) + respond_to do |format| + format.html { redirect_to root_path } + format.atom + end end end