Class: CurationConcern::GenericFilesController
- Inherits:
-
BaseController
show all
- Includes:
- Morphine
- Defined in:
- app/controllers/curation_concern/generic_files_controller.rb
Instance Method Summary
collapse
#contributor_agreement, #save_and_add_related_files_submit_value
#show_action_bar?, #show_site_search?, #sufia
Instance Method Details
#attach_action_breadcrumb ⇒ Object
4
5
6
7
|
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 4
def attach_action_breadcrumb
add_breadcrumb "#{parent.human_readable_type}", polymorphic_path([:curation_concern, parent])
super
end
|
#create ⇒ Object
47
48
49
50
51
52
53
54
55
|
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 47
def create
curation_concern.batch = parent
actor.create!
respond_with([:curation_concern, parent])
rescue ActiveFedora::RecordInvalid
respond_with([:curation_concern, curation_concern]) { |wants|
wants.html { render 'new', status: :unprocessable_entity }
}
end
|
#curation_concern ⇒ Object
34
35
36
37
38
39
40
41
|
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 34
def curation_concern
@curation_concern ||=
if params[:id]
GenericFile.find(params[:id])
else
GenericFile.new(params[:generic_file])
end
end
|
#destroy ⇒ Object
75
76
77
78
79
80
81
|
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 75
def destroy
parent = curation_concern.batch
title = curation_concern.to_s
curation_concern.destroy
flash[:notice] = "Deleted #{title}"
respond_with([:curation_concern, parent])
end
|
#edit ⇒ Object
62
63
64
|
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 62
def edit
respond_with(curation_concern)
end
|
#new ⇒ Object
43
44
45
|
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 43
def new
respond_with(curation_concern)
end
|
#parent ⇒ Object
10
11
12
13
14
15
16
17
|
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 10
def parent
@parent ||=
if params[:id]
curation_concern.batch
else
ActiveFedora::Base.find(namespaced_parent_id,cast: true)
end
end
|
#show ⇒ Object
58
59
60
|
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 58
def show
respond_with(curation_concern)
end
|
#update ⇒ Object
66
67
68
69
70
71
72
73
|
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 66
def update
actor.update!
respond_with([:curation_concern, curation_concern])
rescue ActiveFedora::RecordInvalid
respond_with([:curation_concern, curation_concern]) { |wants|
wants.html { render 'edit', status: :unprocessable_entity }
}
end
|