Sha256: 45bcbcb9c105d5324f2454f191da420fc9d746b9935b1b1492eacb298e2ad185

Contents?: true

Size: 1 KB

Versions: 6

Compression:

Stored size: 1 KB

Contents

class Ckeditor::AttachmentFilesController < Ckeditor::ApplicationController
  skip_before_filter :verify_authenticity_token, only: :create
  
  def index
    @attachments = Ckeditor.attachment_file_adapter.find_all(ckeditor_attachment_files_scope)
    @attachments = Ckeditor::Paginatable.new(@attachments).page(params[:page])

    respond_to do |format|
      format.html { render :layout => @attachments.first_page? }
    end
  end

  def create
    @attachment = Ckeditor.attachment_file_model.new
    respond_with_asset(@attachment)
  end

  def destroy
    @attachment.destroy

    respond_to do |format|
      format.html { redirect_to attachment_files_path }
      format.json { render :nothing => true, :status => 204 }
    end
  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

6 entries across 6 versions & 3 rubygems

Version Path
glebtv-ckeditor-4.5.10.1 app/controllers/ckeditor/attachment_files_controller.rb
glebtv-ckeditor-4.5.7.1 app/controllers/ckeditor/attachment_files_controller.rb
glebtv-ckeditor-4.5.7 app/controllers/ckeditor/attachment_files_controller.rb
ckeditor_custom_controller-4.1.6 app/controllers/ckeditor/attachment_files_controller.rb
ckeditor-4.1.6 app/controllers/ckeditor/attachment_files_controller.rb
ckeditor-4.1.5 app/controllers/ckeditor/attachment_files_controller.rb