Class: CustomReportTemplatesController
Instance Method Summary
collapse
#archivesspace, can_access?, permission_mappings, set_access_control
Instance Method Details
#copy ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'frontend/app/controllers/custom_report_templates_controller.rb', line 31
def copy
handle_crud(:instance => :custom_report_template,
:model => JSONModel(:custom_report_template),
:obj => JSONModel(:custom_report_template).find(params[:id]).dup,
:replace => false,
:copy => true,
:on_invalid => ->() {
render :action => :edit
},
:on_valid => ->(id) {
flash[:success] = t("custom_report_template._frontend.messages.copied")
return redirect_to :controller => :custom_report_templates, :action => :new if params.has_key?(:plus_one)
redirect_to(:controller => :custom_report_templates, :action => :edit, :id => id)
})
end
|
#create ⇒ Object
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'frontend/app/controllers/custom_report_templates_controller.rb', line 47
def create
fix_params
handle_crud(:instance => :custom_report_template,
:model => JSONModel(:custom_report_template),
:on_invalid => ->() {
render :action => "new"
},
:on_valid => ->(id) {
flash[:success] = t("custom_report_template._frontend.messages.created")
return redirect_to :controller => :custom_report_templates, :action => :new if params.has_key?(:plus_one)
redirect_to(:controller => :custom_report_templates, :action => :index)
})
end
|
#current_record ⇒ Object
14
15
16
|
# File 'frontend/app/controllers/custom_report_templates_controller.rb', line 14
def current_record
@custom_report_template
end
|
#delete ⇒ Object
77
78
79
80
81
82
|
# File 'frontend/app/controllers/custom_report_templates_controller.rb', line 77
def delete
custom_report_template = JSONModel(:custom_report_template).find(params[:id])
custom_report_template.delete
redirect_to(:controller => :custom_report_templates, :action => :index, :deleted_uri => custom_report_template.uri)
end
|
#edit ⇒ Object
10
11
12
|
# File 'frontend/app/controllers/custom_report_templates_controller.rb', line 10
def edit
@custom_report_template = JSONModel(:custom_report_template).find(params[:id])
end
|
#index ⇒ Object
22
23
24
25
26
27
28
29
|
# File 'frontend/app/controllers/custom_report_templates_controller.rb', line 22
def index
@search_data = JSONModel(:custom_report_template).all(
page: selected_page,
page_size: 50,
sort_field: params.fetch(:sort, :name),
sort_direction: params.fetch(:direction, :asc)
)
end
|
#new ⇒ Object
6
7
8
|
# File 'frontend/app/controllers/custom_report_templates_controller.rb', line 6
def new
@custom_report_template = JSONModel(:custom_report_template).new._always_valid!
end
|
#show ⇒ Object
18
19
20
|
# File 'frontend/app/controllers/custom_report_templates_controller.rb', line 18
def show
@custom_report_template = JSONModel(:custom_report_template).find(params[:id])
end
|
#update ⇒ Object
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# File 'frontend/app/controllers/custom_report_templates_controller.rb', line 61
def update
fix_params
handle_crud(:instance => :custom_report_template,
:model => JSONModel(:custom_report_template),
:obj => JSONModel(:custom_report_template).find(params[:id]),
:replace => true,
:on_invalid => ->() {
render :action => :edit
},
:on_valid => ->(id) {
flash[:success] = t("custom_report_template._frontend.messages.updated")
return redirect_to :controller => :custom_report_templates, :action => :new if params.has_key?(:plus_one)
redirect_to(:controller => :custom_report_templates, :action => :index)
})
end
|