Class: CurationConcern::GenericFilesController
Instance Method Summary
collapse
#parent
#authorize_curation_concern!, #contributor_agreement
Instance Method Details
#attach_action_breadcrumb ⇒ Object
6
7
8
9
|
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 6
def attach_action_breadcrumb
add_breadcrumb "#{parent.human_readable_type}", polymorphic_path([:curation_concern, parent])
super
end
|
#create ⇒ Object
33
34
35
36
37
38
39
40
41
42
|
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 33
def create
curation_concern.batch = parent
if actor.create
respond_with([:curation_concern, parent])
else
respond_with([:curation_concern, curation_concern]) { |wants|
wants.html { render 'new', status: :unprocessable_entity }
}
end
end
|
#curation_concern ⇒ Object
20
21
22
23
24
25
26
27
|
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 20
def curation_concern
@curation_concern ||=
if params[:id]
GenericFile.find(params[:id])
else
GenericFile.new(params[:generic_file])
end
end
|
#destroy ⇒ Object
77
78
79
80
81
82
|
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 77
def destroy
parent = curation_concern.batch
flash[:notice] = "Deleted #{curation_concern}"
curation_concern.destroy
respond_with([:curation_concern, parent])
end
|
#edit ⇒ Object
49
50
51
|
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 49
def edit
respond_with(curation_concern)
end
|
#new ⇒ Object
29
30
31
|
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 29
def new
respond_with(curation_concern)
end
|
#rollback ⇒ Object
67
68
69
70
71
72
73
74
75
|
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 67
def rollback
if actor.rollback
respond_with([:curation_concern, curation_concern])
else
respond_with([:curation_concern, curation_concern]) { |wants|
wants.html { render 'versions', status: :unprocessable_entity }
}
end
end
|
#show ⇒ Object
45
46
47
|
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 45
def show
respond_with(curation_concern)
end
|
#update ⇒ Object
53
54
55
56
57
58
59
60
61
|
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 53
def update
if actor.update
respond_with([:curation_concern, curation_concern])
else
respond_with([:curation_concern, curation_concern]) { |wants|
wants.html { render 'edit', status: :unprocessable_entity }
}
end
end
|
#versions ⇒ Object
63
64
65
|
# File 'app/controllers/curation_concern/generic_files_controller.rb', line 63
def versions
respond_with(curation_concern)
end
|