Sha256: 343f342d8d69634b360052217c923449aa068d907ae9fdfc1d2172a482271e0d

Contents?: true

Size: 1.04 KB

Versions: 19

Compression:

Stored size: 1.04 KB

Contents

class Admin::CommentsController < Admin::BaseController
  unloadable
  sortable_attributes :created_at, :name, :comment

  def index

    case
    when params[:article_id]
      @commentable = Article.find_by_id( params[:article_id] )
      @comments = @commentable.comments.paginate :page => params[:page], :order => sort_order
    else
      @comments = Comment.paginate :page => params[:page], :order => sort_order
    end

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @articles }
    end
  end

  def destroy
    @comment = Comment.find(params[:id])
    if spam_markable? and params[:spam]
      Viking.mark_as_spam(@comment.spam_signature)
    end
    @comment.destroy
    flash[:notice] = 'Comment was successfully deleted.'

    respond_to do |format|
      format.html { redirect_to( :back ) }
      format.xml  { head :ok }
    end
  end
  
protected
  
  def spam_markable?
    @spam_markable ||= defined?( Viking ) and Comment.new.respond_to?(:spam_signature)
  end
  helper_method :spam_markable?
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
beef-articles-0.4.18 app/controllers/admin/comments_controller.rb
beef-articles-0.4.17 app/controllers/admin/comments_controller.rb
beef-articles-0.4.16 app/controllers/admin/comments_controller.rb
beef-articles-0.4.15 app/controllers/admin/comments_controller.rb
beef-articles-0.4.14 app/controllers/admin/comments_controller.rb
beef-articles-0.4.13 app/controllers/admin/comments_controller.rb
beef-articles-0.4.12 app/controllers/admin/comments_controller.rb
beef-articles-0.4.11 app/controllers/admin/comments_controller.rb
beef-articles-0.4.10 app/controllers/admin/comments_controller.rb
beef-articles-0.4.9 app/controllers/admin/comments_controller.rb
beef-articles-0.4.8 app/controllers/admin/comments_controller.rb
beef-articles-0.4.7 app/controllers/admin/comments_controller.rb
beef-articles-0.4.6 app/controllers/admin/comments_controller.rb
beef-articles-0.4.5 app/controllers/admin/comments_controller.rb
beef-articles-0.4.4 app/controllers/admin/comments_controller.rb
beef-articles-0.4.3 app/controllers/admin/comments_controller.rb
beef-articles-0.4.2 app/controllers/admin/comments_controller.rb
beef-articles-0.4.1 app/controllers/admin/comments_controller.rb
beef-articles-0.4.0 app/controllers/admin/comments_controller.rb