Sha256: d1565536cda5ebd99a24a7af219020b672cf7f311f0f7ef933288f2205647b69

Contents?: true

Size: 941 Bytes

Versions: 6

Compression:

Stored size: 941 Bytes

Contents

class Ckeditor::PicturesController < Ckeditor::ApplicationController
  skip_before_filter :verify_authenticity_token, only: :create

  def index
    @pictures = Ckeditor.picture_adapter.find_all(ckeditor_pictures_scope)
    @pictures = Ckeditor::Paginatable.new(@pictures).page(params[:page])

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

  def create
    @picture = Ckeditor.picture_model.new
    respond_with_asset(@picture)
  end

  def destroy
    @picture.destroy

    respond_to do |format|
      format.html { redirect_to pictures_path }
      format.json { render :nothing => true, :status => 204 }
    end
  end

  protected

    def find_asset
      @picture = Ckeditor.picture_adapter.get!(params[:id])
    end

    def authorize_resource
      model = (@picture || Ckeditor.picture_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/pictures_controller.rb
glebtv-ckeditor-4.5.7.1 app/controllers/ckeditor/pictures_controller.rb
glebtv-ckeditor-4.5.7 app/controllers/ckeditor/pictures_controller.rb
ckeditor_custom_controller-4.1.6 app/controllers/ckeditor/pictures_controller.rb
ckeditor-4.1.6 app/controllers/ckeditor/pictures_controller.rb
ckeditor-4.1.5 app/controllers/ckeditor/pictures_controller.rb