Class: Gluttonberg::Admin::AssetLibrary::CollectionsController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- BaseController
- BaseController
- Gluttonberg::Admin::AssetLibrary::CollectionsController
- Defined in:
- app/controllers/gluttonberg/admin/asset_library/collections_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/gluttonberg/admin/asset_library/collections_controller.rb', line 17 def create @collection = AssetCollection.new(params[:collection]) @collection.user_id = current_user.id if @collection.save flash[:notice] = "The collection was successfully created." # library home page redirect_to admin_assets_path else render :new end end |
#delete ⇒ Object
39 40 41 42 43 44 45 |
# File 'app/controllers/gluttonberg/admin/asset_library/collections_controller.rb', line 39 def delete display_delete_confirmation( :title => "Delete “#{@collection.name}” asset collection?", :url => admin_collection_path(@collection), :return_url => admin_collections_path ) end |
#destroy ⇒ Object
47 48 49 50 51 52 53 |
# File 'app/controllers/gluttonberg/admin/asset_library/collections_controller.rb', line 47 def destroy generic_destroy(@collection, { :name => "collection", :success_path => admin_assets_path, :failure_path => admin_assets_path }) end |
#index ⇒ Object
9 10 11 |
# File 'app/controllers/gluttonberg/admin/asset_library/collections_controller.rb', line 9 def index @collections = AssetCollection.all end |
#new ⇒ Object
13 14 15 |
# File 'app/controllers/gluttonberg/admin/asset_library/collections_controller.rb', line 13 def new @collection = AssetCollection.new end |
#update ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/gluttonberg/admin/asset_library/collections_controller.rb', line 29 def update if @collection.update_attributes(params[:collection]) flash[:notice] = "The collection was successfully updated." redirect_to admin_assets_path else flash[:error] = "Sorry, The collection could not be updated." render :new end end |