Sha256: 1d7fcf3c899bade66b01248a105b8f818d39c01a742d33978e7d09ef1a56f25a

Contents?: true

Size: 1.02 KB

Versions: 15

Compression:

Stored size: 1.02 KB

Contents

module Admin
  class AssetsController < BaseController
    
    sections 'assets'  
    
    before_filter :set_collections_and_current_collection
    
    def new
      @asset = @collection.assets.build
    end

    def edit
      @asset = @collection.assets.find(params[:id])
    end

    def create
      @asset = @collection.assets.build(params[:asset])

      if @asset.save
        flash_success!
        redirect_to edit_admin_asset_collection_url(@collection)
      else
        flash_error!
        render :action => 'new'
      end
    end

    def update
      @asset = @collection.assets.find(params[:id])

      if @asset.update_attributes(params[:asset])
        flash_success!
        redirect_to edit_admin_asset_collection_url(@collection)
      else
        flash_error!
        render :action => 'edit'
      end
    end
  
    protected 
  
    def set_collections_and_current_collection
      @collections = current_site.asset_collections
      @collection = @collections.find(params[:collection_id])
    end
    
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
locomotive_cms-0.0.2.9 app/controllers/admin/assets_controller.rb
locomotive_cms-0.0.2.8 app/controllers/admin/assets_controller.rb
locomotive_cms-0.0.2.7 app/controllers/admin/assets_controller.rb
locomotive_cms-0.0.2.6 app/controllers/admin/assets_controller.rb
locomotive_cms-0.0.2.5 app/controllers/admin/assets_controller.rb
locomotive_cms-0.0.2.4 app/controllers/admin/assets_controller.rb
locomotive_cms-0.0.2.3 app/controllers/admin/assets_controller.rb
locomotive_cms-0.0.2.2 app/controllers/admin/assets_controller.rb
locomotive_cms-0.0.2.1 app/controllers/admin/assets_controller.rb
locomotive_cms-0.0.2 app/controllers/admin/assets_controller.rb
locomotive_cms-0.0.1.4 app/controllers/admin/assets_controller.rb
locomotive_cms-0.0.1.3 app/controllers/admin/assets_controller.rb
locomotive_cms-0.0.1.2 app/controllers/admin/assets_controller.rb
locomotive_cms-0.0.1.1 app/controllers/admin/assets_controller.rb
locomotive_cms-0.0.1 app/controllers/admin/assets_controller.rb