Sha256: e02ce9fef42fa72974b487ea735de620c6bc1c9baab9f0e51dd96c741fb15a27

Contents?: true

Size: 766 Bytes

Versions: 17

Compression:

Stored size: 766 Bytes

Contents

Admin.controllers :uploads do

  get :index, :respond_to => [:js, :json] do
    @store      = Upload.column_store(options.views, "uploads/store")
    @session_id = options.session_id
    case content_type
      when :js    then render 'uploads/grid.js'
      when :json  then @store.store_data(params)
    end
  end

  post :create do
    @upload = Upload.new
    @upload.file = params[:file]
    @upload.save
    render :success => true
  end

  delete :destroy, :respond_to => :json do
    uploads = Upload.all(:conditions => { :id => params[:ids].split(",") })
    errors = uploads.map { |upload| I18n.t("admin.general.cantDelete", :record => upload.id) unless upload.destroy }.compact
    render :success => errors.empty?, :msg => errors.join("<br />")
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
padrino-admin-0.8.5 lib/padrino-admin/generators/templates/uploader/controller.rb
padrino-admin-0.8.4 lib/padrino-admin/generators/templates/uploader/controller.rb
padrino-admin-0.8.3 lib/padrino-admin/generators/templates/uploader/controller.rb
padrino-admin-0.8.2 lib/padrino-admin/generators/templates/uploader/controller.rb
padrino-admin-0.8.1 lib/padrino-admin/generators/templates/uploader/controller.rb
padrino-admin-0.8.0 lib/padrino-admin/generators/templates/uploader/controller.rb
padrino-admin-0.7.9 lib/padrino-admin/generators/templates/uploader/controller.rb
padrino-admin-0.7.8 lib/padrino-admin/generators/templates/uploader/controller.rb
padrino-admin-0.7.7 lib/padrino-admin/generators/templates/uploader/controller.rb
padrino-admin-0.7.6 lib/padrino-admin/generators/templates/uploader/controller.rb
padrino-admin-0.7.5 lib/padrino-admin/generators/templates/uploader/controller.rb
padrino-admin-0.7.4 lib/padrino-admin/generators/templates/uploader/controller.rb
padrino-admin-0.7.3 lib/padrino-admin/generators/templates/uploader/controller.rb
padrino-admin-0.7.2 lib/padrino-admin/generators/templates/uploader/controller.rb
padrino-admin-0.7.1 lib/padrino-admin/generators/templates/uploader/controller.rb
padrino-admin-0.7.0 lib/padrino-admin/generators/templates/uploader/controller.rb
padrino-admin-0.6.7 lib/padrino-admin/generators/templates/uploader/controller.rb