Sha256: 7543737c0140171eff9666eae022b0f85a30ec20952b224345514a3c32f1ca44

Contents?: true

Size: 671 Bytes

Versions: 8

Compression:

Stored size: 671 Bytes

Contents

class Admin::AdminCommentsController < Admin::BaseController
  load_and_authorize_resource

  helper_method :commentable

  def create
    create! do |format|
      format.js {}
    end
  end

  def destroy
    destroy! do |format|
      format.js {}
    end
  end

  private

  def collection
    if xhr?
      @collection = AdminComment.find_for_resource(commentable)
    else
      super
    end
  end

  def commentable
    @commentable ||= AdminComment.find_resource(params[:resource_type], params[:resource_id])
  end

  def permitted_params
    params[:admin_comment].try!(:permit, :body, :resource_id, :resource_type, *AbAdmin.default_permitted_params)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ab_admin-0.11.0 app/controllers/admin/admin_comments_controller.rb
ab_admin-0.10.0 app/controllers/admin/admin_comments_controller.rb
ab_admin-0.9.0 app/controllers/admin/admin_comments_controller.rb
ab_admin-0.8.3 app/controllers/admin/admin_comments_controller.rb
ab_admin-0.8.2 app/controllers/admin/admin_comments_controller.rb
ab_admin-0.8.1 app/controllers/admin/admin_comments_controller.rb
ab_admin-0.8.0 app/controllers/admin/admin_comments_controller.rb
ab_admin-0.7.0 app/controllers/admin/admin_comments_controller.rb