Class: Atrium::ExhibitsController
Instance Method Summary
collapse
#atrium_config
#facet_element, #get_parent_path, #get_showcase_parent_edit_path, #get_showcase_parent_show_path, #render_showcase_facet_selection
#application_name
#get_saved_items, #get_saved_search, #saved_searches_for_select
Instance Method Details
#collection ⇒ Object
46
47
48
49
50
|
# File 'app/controllers/atrium/exhibits_controller.rb', line 46
def collection
@collection ||= find_collection
end
|
#create ⇒ Object
10
11
12
13
14
15
16
17
18
|
# File 'app/controllers/atrium/exhibits_controller.rb', line 10
def create
@exhibit = collection.exhibits.build(params[:exhibit])
if @exhibit.save!
flash[:notice] = 'Exhibit was successfully created.'
redirect_to edit_collection_exhibit_path(id:@exhibit.id, collection_id:@collection)
else
render action: "new"
end
end
|
#destroy ⇒ Object
35
36
37
38
39
|
# File 'app/controllers/atrium/exhibits_controller.rb', line 35
def destroy
@exhibit.destroy
flash[:notice] = 'Exhibit '+params[:id] +' was deleted successfully.'
redirect_to edit_collection_path(@collection)
end
|
#edit ⇒ Object
20
21
22
|
# File 'app/controllers/atrium/exhibits_controller.rb', line 20
def edit
end
|
#find_collection ⇒ Object
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'app/controllers/atrium/exhibits_controller.rb', line 52
def find_collection
begin
logger.debug("Finding collection")
if params[:collection_id]
@collection = Atrium::Collection.find(params[:collection_id])
elsif params[:id]
@exhibit = Atrium::Exhibit.find(params[:id])
@collection = @exhibit.collection
else
raise "Could not find collection_id"
end
rescue ActiveRecord::RecordNotFound
flash.alert = t("Atrium.collection.or.exhibit.not_found")
redirect_to redirect_target and return
end
@collection
end
|
#find_exhibit ⇒ Object
42
43
44
|
# File 'app/controllers/atrium/exhibits_controller.rb', line 42
def find_exhibit
@exhibit = collection.exhibits.find(params[:id])
end
|
#new ⇒ Object
6
7
8
|
# File 'app/controllers/atrium/exhibits_controller.rb', line 6
def new
@exhibit = collection.exhibits.build(params[:exhibit])
end
|
#show ⇒ Object
31
32
33
|
# File 'app/controllers/atrium/exhibits_controller.rb', line 31
def show
@showcases = @exhibit.showcases
end
|
#update ⇒ Object
24
25
26
27
28
29
|
# File 'app/controllers/atrium/exhibits_controller.rb', line 24
def update
if @exhibit.update_attributes(params[:exhibit])
flash[:notice] = 'Exhibit was successfully updated.'
end
render action: "edit"
end
|