Sha256: 414d5c0d8a9089e97a3f349559a256ba33c9966e33073e5fdbc342097990b798

Contents?: true

Size: 764 Bytes

Versions: 2

Compression:

Stored size: 764 Bytes

Contents

class Ckeditor::PicturesController < Ckeditor::ApplicationController

  def index
    @pictures = Ckeditor.picture_adapter.find_all(ckeditor_pictures_scope)
    @pictures = Ckeditor::Paginatable.new(@pictures).page(params[:page])
    
    respond_with(@pictures, :layout => @pictures.first_page?) 
  end
  
  def create
    @picture = Ckeditor.picture_model.new
	  respond_with_asset(@picture)
  end
  
  def destroy
    @picture.destroy
    respond_with(@picture, :location => pictures_path)
  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

2 entries across 2 versions & 1 rubygems

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