Sha256: 0137f67a3389cdb325680bdefa1c71c01126c15355d4a4a093287726b484bf8e

Contents?: true

Size: 851 Bytes

Versions: 2

Compression:

Stored size: 851 Bytes

Contents

class Ckeditor::AttachmentFilesController < Ckeditor::ApplicationController

  def index
    @attachments = Ckeditor.attachment_file_adapter.find_all(ckeditor_attachment_files_scope)
    @attachments = Ckeditor::Paginatable.new(@attachments).page(params[:page])
    
    respond_with(@attachments, :layout => @attachments.first_page?)
  end
  
  def create
    @attachment = Ckeditor.attachment_file_model.new
	  respond_with_asset(@attachment)
  end
  
  def destroy
    @attachment.destroy
    respond_with(@attachment, :location => attachment_files_path)
  end
  
  protected
  
    def find_asset
      @attachment = Ckeditor.attachment_file_adapter.get!(params[:id])
    end

    def authorize_resource
      model = (@attachment || Ckeditor.attachment_file_model)
      @authorization_adapter.try(:authorize, params[:action], model)
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ckeditor-4.0.9 app/controllers/ckeditor/attachment_files_controller.rb
ckeditor-4.0.8 app/controllers/ckeditor/attachment_files_controller.rb