Class: Atrium::DescriptionsController
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
#create ⇒ Object
15
16
17
18
19
20
21
22
23
|
# File 'app/controllers/atrium/descriptions_controller.rb', line 15
def create
@description = showcase.descriptions.build(params[:description])
if @description.save
flash[:notice] = 'Description was successfully created.'
redirect_to edit_showcase_description_path(showcase, @description)
else
render action: "new"
end
end
|
#destroy ⇒ Object
40
41
42
43
44
|
# File 'app/controllers/atrium/descriptions_controller.rb', line 40
def destroy
description.destroy
flash[:notice] = 'Description '+@description.pretty_title + ' was deleted successfully.'
redirect_to edit_showcase_path(@showcase)
end
|
#edit ⇒ Object
25
26
27
28
|
# File 'app/controllers/atrium/descriptions_controller.rb', line 25
def edit
description.build_essay(content_type:"essay") unless description.essay
description.build_summary(content_type:"summary") unless description.summary
end
|
#index ⇒ Object
5
6
7
|
# File 'app/controllers/atrium/descriptions_controller.rb', line 5
def index
@descriptions = showcase.descriptions
end
|
#new ⇒ Object
9
10
11
12
13
|
# File 'app/controllers/atrium/descriptions_controller.rb', line 9
def new
@description = showcase.descriptions.build(params[:description])
@description.build_essay(content_type:"essay")
@description.build_summary(content_type:"summary")
end
|
#update ⇒ Object
30
31
32
33
34
35
36
37
38
|
# File 'app/controllers/atrium/descriptions_controller.rb', line 30
def update
if description.update_attributes(params[:description])
flash[:notice] = 'Description was successfully updated.'
redirect_to edit_showcase_description_path(showcase, @description)
else
flash.now.alert = 'Description update failed'
render action: "edit"
end
end
|