Sha256: 45d716f3d78dbb449f8a4f72a62c0128807ad946ef7c347f5228d215f1ef2f89

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

class Ckeditor::AttachmentFilesController < Ckeditor::ApplicationController
  skip_before_action :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

1 entries across 1 versions & 1 rubygems

Version Path
ckeditor-4.1.4 app/controllers/ckeditor/attachment_files_controller.rb