Sha256: 3468176132ea3df7396e991812bdcd0a93090cfca8f64f22989b1adb99eeb458

Contents?: true

Size: 1.47 KB

Versions: 11

Compression:

Stored size: 1.47 KB

Contents

module Admin
  class AssetCollectionsController < BaseController
    
    sections 'assets'  
    
    before_filter :set_collections
  
    def index
      if not @collections.empty?
        redirect_to(edit_admin_asset_collection_url(@collections.first)) and return
      end
    end
  
    def show
      @collection = current_site.asset_collections.find(params[:id])
      render :action => 'edit'
    end

    def new
      @collection = current_site.asset_collections.build
    end

    def edit
      @collection = current_site.asset_collections.find(params[:id])
    end

    def create
      @collection = current_site.asset_collections.build(params[:asset_collection])

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

    def update
      @collection = current_site.asset_collections.find(params[:id])

      if @collection.update_attributes(params[:asset_collection])
        flash_success!
        redirect_to edit_admin_asset_collection_url(@collection)
      else
        flash_error!
        render :action => 'edit'
      end
    end

    def destroy
      @collection = current_site.asset_collections.find(params[:id])
      @collection.destroy

      flash_success!

      redirect_to admin_asset_collections_url
    end
  
    protected 
  
    def set_collections
      @collections = current_site.asset_collections
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
locomotive_cms-0.0.2.5 app/controllers/admin/asset_collections_controller.rb
locomotive_cms-0.0.2.4 app/controllers/admin/asset_collections_controller.rb
locomotive_cms-0.0.2.3 app/controllers/admin/asset_collections_controller.rb
locomotive_cms-0.0.2.2 app/controllers/admin/asset_collections_controller.rb
locomotive_cms-0.0.2.1 app/controllers/admin/asset_collections_controller.rb
locomotive_cms-0.0.2 app/controllers/admin/asset_collections_controller.rb
locomotive_cms-0.0.1.4 app/controllers/admin/asset_collections_controller.rb
locomotive_cms-0.0.1.3 app/controllers/admin/asset_collections_controller.rb
locomotive_cms-0.0.1.2 app/controllers/admin/asset_collections_controller.rb
locomotive_cms-0.0.1.1 app/controllers/admin/asset_collections_controller.rb
locomotive_cms-0.0.1 app/controllers/admin/asset_collections_controller.rb