Class: GroupsController
Constant Summary
Constants included
from Searchable
Searchable::ABSTRACT
Instance Method Summary
collapse
#archivesspace, can_access?, permission_mappings, set_access_control
Methods included from JsonHelper
#merge_notes, #process_json_notes
Methods included from Searchable
#default_search_opts, #get_filter_years, #handle_results, #html_notes, #process_results, #process_search_results, #repo_context, #search_terms, #set_up_advanced_search, #set_up_and_run_search, #set_up_search, #strip_facet_fields
#fetch_only_facets, #get_pretty_facet_value, #strip_facets
#inheritance, #process_mixed_content, #strip_mixed_content
Instance Method Details
#create ⇒ Object
31
32
33
34
35
|
# File 'frontend/app/controllers/groups_controller.rb', line 31
def create
handle_crud(:instance => :group,
:on_invalid => ->() { render :action => "new" },
:on_valid => ->(id) { redirect_to(:controller => :groups, :action => :index) })
end
|
#current_record ⇒ Object
16
17
18
|
# File 'frontend/app/controllers/groups_controller.rb', line 16
def current_record
@group
end
|
#delete ⇒ Object
55
56
57
58
59
60
|
# File 'frontend/app/controllers/groups_controller.rb', line 55
def delete
group = JSONModel(:group).find(params[:id])
group.delete
redirect_to(:controller => :groups, :action => :index, :deleted_uri => group.uri)
end
|
#edit ⇒ Object
26
27
28
|
# File 'frontend/app/controllers/groups_controller.rb', line 26
def edit
@group = JSONModel(:group).find(params[:id])
end
|
#index ⇒ Object
11
12
13
|
# File 'frontend/app/controllers/groups_controller.rb', line 11
def index
@groups = JSONModel(:group).all
end
|
#new ⇒ Object
6
7
8
|
# File 'frontend/app/controllers/groups_controller.rb', line 6
def new
@group = JSONModel(:group).new._always_valid!
end
|
#show ⇒ Object
21
22
23
|
# File 'frontend/app/controllers/groups_controller.rb', line 21
def show
redirect_to :action => :index
end
|
#update ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'frontend/app/controllers/groups_controller.rb', line 38
def update
params[:group][:grants_permissions] ||= []
params[:group][:member_usernames] ||= []
handle_crud(:instance => :group,
:model => Accession,
:obj => JSONModel(:group).find(params[:id]),
:replace => false,
:on_invalid => ->() {
return render :action => "edit"
},
:on_valid => ->(id) {
redirect_to(:controller => :groups, :action => :index)
})
end
|