Class: Atrium::CollectionsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/atrium/collections_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#atrium_config

Methods included from ShowcasesHelper

#facet_element, #get_parent_path, #get_showcase_parent_edit_path, #get_showcase_parent_show_path, #render_showcase_facet_selection

Methods included from ApplicationHelper

#application_name

Methods included from CollectionsHelper

#get_saved_items, #get_saved_search, #saved_searches_for_select

Instance Method Details

#createObject



14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/atrium/collections_controller.rb', line 14

def create
  @collection = Atrium::Collection.new(params[:collection])
  if @collection.save
    flash[:notice] = "Collection created successfully"
    redirect_to edit_collection_path(@collection)
  else
    flash.now.alert = "Collection not created successfully"
    render action: "new"
  end
end

#destroyObject



46
47
48
49
50
# File 'app/controllers/atrium/collections_controller.rb', line 46

def destroy
  collection.destroy
  flash[:notice] = 'Collection '+ @collection.pretty_title+' was deleted successfully.'
  redirect_to collections_path
end

#editObject



25
26
27
# File 'app/controllers/atrium/collections_controller.rb', line 25

def edit
  collection
end

#indexObject



6
7
8
# File 'app/controllers/atrium/collections_controller.rb', line 6

def index
  @collections = Collection.all
end

#newObject



10
11
12
# File 'app/controllers/atrium/collections_controller.rb', line 10

def new
  @collection = Atrium::Collection.new(params[:collection])
end

#showObject



29
30
31
32
33
34
35
# File 'app/controllers/atrium/collections_controller.rb', line 29

def show
  @exhibits = collection.exhibits
  respond_to do |format|
    format.html
    format.atom { render layout: false }
  end
end

#updateObject



37
38
39
40
41
42
43
44
# File 'app/controllers/atrium/collections_controller.rb', line 37

def update
  if collection.update_attributes(params[:collection])
    flash[:notice] = 'Collection was successfully updated.'
  else
    flash.now.alert = "Collection Not updated"
  end
  render action: "edit"
end