Sha256: 1ed60233e8c778f19fffb816e7d6e23833aff31505d415852b0ff7cb967a5333

Contents?: true

Size: 1.46 KB

Versions: 5

Compression:

Stored size: 1.46 KB

Contents

module Refinery
  module Blog
    module Admin
      class CommentsController < ::Refinery::AdminController

        cache_sweeper Refinery::BlogSweeper

        crudify :'refinery/blog/comment',
                :title_attribute => :name,
                :order => 'published_at DESC'

        def index
          @comments = Refinery::Blog::Comment.unmoderated.page(params[:page])

          render :action => 'index'
        end

        def approved
          unless params[:id].present?
            @comments = Refinery::Blog::Comment.approved.page(params[:page])

            render :action => 'index'
          else
            @comment = Refinery::Blog::Comment.find(params[:id])
            @comment.approve!
            flash[:notice] = t('approved', :scope => 'refinery.blog.admin.comments', :author => @comment.name)

            redirect_to refinery.url_for(:action => params[:return_to] || 'index', :id => nil)
          end
        end

        def rejected
          unless params[:id].present?
            @comments = Refinery::Blog::Comment.rejected.page(params[:page])

            render :action => 'index'
          else
            @comment = Refinery::Blog::Comment.find(params[:id])
            @comment.reject!
            flash[:notice] = t('rejected', :scope => 'refinery.blog.admin.comments', :author => @comment.name)

            redirect_to refinery.url_for(:action => params[:return_to] || 'index', :id => nil)
          end
        end

      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
refinerycms-blog-2.0.4 app/controllers/refinery/blog/admin/comments_controller.rb
refinerycms-blog-2.0.3 app/controllers/refinery/blog/admin/comments_controller.rb
refinerycms-blog-2.0.2 app/controllers/refinery/blog/admin/comments_controller.rb
refinerycms-blog-2.0.1 app/controllers/refinery/blog/admin/comments_controller.rb
refinerycms-blog-2.0.0 app/controllers/refinery/blog/admin/comments_controller.rb