Class: ContainerProfilesController
Constant Summary
Constants included
from Searchable
Searchable::ABSTRACT
Instance Method Summary
collapse
#csv_response, #xml_response
#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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'frontend/app/controllers/container_profiles_controller.rb', line 43
def create
handle_crud(:instance => :container_profile,
:model => JSONModel(:container_profile),
:on_invalid => ->() {
return render_aspace_partial :partial => "container_profiles/new" if inline?
return render :action => :new
},
:on_valid => ->(id) {
if inline?
@container_profile.refetch
render :json => @container_profile.to_hash if inline?
else
flash[:success] = I18n.t("container_profile._frontend.messages.created")
return redirect_to :controller => :container_profiles, :action => :new if params.has_key?(:plus_one)
redirect_to(:controller => :container_profiles, :action => :show, :id => id)
end
})
end
|
#current_record ⇒ Object
29
30
31
|
# File 'frontend/app/controllers/container_profiles_controller.rb', line 29
def current_record
@container_profile
end
|
#delete ⇒ Object
77
78
79
80
81
82
|
# File 'frontend/app/controllers/container_profiles_controller.rb', line 77
def delete
container_profile = JSONModel(:container_profile).find(params[:id])
container_profile.delete
redirect_to(:controller => :container_profiles, :action => :index, :deleted_uri => container_profile.uri)
end
|
#edit ⇒ Object
38
39
40
|
# File 'frontend/app/controllers/container_profiles_controller.rb', line 38
def edit
@container_profile = JSONModel(:container_profile).find(params[:id])
end
|
#index ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'frontend/app/controllers/container_profiles_controller.rb', line 15
def index
respond_to do |format|
format.html {
@search_data = Search.for_type(session[:repo_id], "container_profile", params_for_backend_search.merge({"facet[]" => SearchResultData.CONTAINER_PROFILE_FACETS}))
}
format.csv {
search_params = params_for_backend_search.merge({"facet[]" => SearchResultData.CONTAINER_PROFILE_FACETS})
search_params["type[]"] = "container_profile"
uri = "/repositories/#{session[:repo_id]}/search"
csv_response( uri, Search.build_filters(search_params), "#{I18n.t('container_profile._plural').downcase}." )
}
end
end
|
#new ⇒ Object
8
9
10
11
12
|
# File 'frontend/app/controllers/container_profiles_controller.rb', line 8
def new
@container_profile = JSONModel(:container_profile).new._always_valid!
render_aspace_partial :partial => "container_profiles/new" if inline?
end
|
#show ⇒ Object
33
34
35
|
# File 'frontend/app/controllers/container_profiles_controller.rb', line 33
def show
@container_profile = JSONModel(:container_profile).find(params[:id])
end
|
#typeahead ⇒ Object
85
86
87
88
89
90
91
|
# File 'frontend/app/controllers/container_profiles_controller.rb', line 85
def typeahead
search_params = params_for_backend_search
search_params = search_params.merge("sort" => "typeahead_sort_key_u_sort asc")
render :json => Search.all(session[:repo_id], search_params)
end
|
#update ⇒ Object
63
64
65
66
67
68
69
70
71
72
73
74
|
# File 'frontend/app/controllers/container_profiles_controller.rb', line 63
def update
handle_crud(:instance => :container_profile,
:model => JSONModel(:container_profile),
:obj => JSONModel(:container_profile).find(params[:id]),
:replace => true,
:on_invalid => ->() {
return render :action => :edit
},
:on_valid => ->(id) {
redirect_to(:controller => :container_profiles, :action => :show, :id => id)
})
end
|