Class: CollectionManagementRecordsController
Instance Method Summary
collapse
#archivesspace, can_access?, permission_mappings, set_access_control
Instance Method Details
#create ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'frontend/app/controllers/collection_management_records_controller.rb', line 28
def create
handle_crud(:instance => :collection_management,
:on_invalid => ->() {
render :action => :new
},
:on_valid => ->(id) {
flash[:success] = t("collection_management._frontend.messages.created")
return redirect_to :controller => :collection_management_records, :action => :new if params.has_key?(:plus_one)
redirect_to :controller => :collection_management_records, :action => :index, :id => id
})
end
|
#current_record ⇒ Object
11
12
13
|
# File 'frontend/app/controllers/collection_management_records_controller.rb', line 11
def current_record
@collection_management
end
|
#edit ⇒ Object
24
25
26
|
# File 'frontend/app/controllers/collection_management_records_controller.rb', line 24
def edit
@collection_management = JSONModel(:collection_management).find(params[:id], "resolve[]" => ["linked_records"])
end
|
#index ⇒ Object
7
8
9
|
# File 'frontend/app/controllers/collection_management_records_controller.rb', line 7
def index
@search_data = JSONModel(:collection_management).all(:page => 1)
end
|
#new ⇒ Object
19
20
21
22
|
# File 'frontend/app/controllers/collection_management_records_controller.rb', line 19
def new
@collection_management = JSONModel(:collection_management).new._always_valid!
@collection_management.linked_records = [{}]
end
|
#show ⇒ Object
15
16
17
|
# File 'frontend/app/controllers/collection_management_records_controller.rb', line 15
def show
@collection_management = JSONModel(:collection_management).find(params[:id], "resolve[]" => ["linked_records"])
end
|
#update ⇒ Object
41
42
43
44
45
46
47
48
49
|
# File 'frontend/app/controllers/collection_management_records_controller.rb', line 41
def update
handle_crud(:instance => :collection_management,
:obj => JSONModel(:collection_management).find(params[:id]),
:on_invalid => ->() { render :action => :edit },
:on_valid => ->(id) {
flash[:success] = t("collection_management._frontend.messages.updated")
redirect_to :controller => :collection_management_records, :action => :index
})
end
|