Class: LocationProfilesController
Constant Summary
collapse
- FACETS =
["location_profile_width_u_sstr", "location_profile_height_u_sstr", "location_profile_depth_u_sstr", "location_profile_dimension_units_u_sstr"]
Class Method Summary
collapse
Instance Method Summary
collapse
#archivesspace, can_access?, permission_mappings, set_access_control
Class Method Details
.FACETS ⇒ Object
11
12
13
|
# File 'frontend/app/controllers/location_profiles_controller.rb', line 11
def self.FACETS
FACETS
end
|
Instance Method Details
#create ⇒ Object
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'frontend/app/controllers/location_profiles_controller.rb', line 53
def create
handle_crud(:instance => :location_profile,
:model => JSONModel(:location_profile),
:on_invalid => ->() {
return render_aspace_partial :partial => "location_profiles/new" if inline?
return render :action => :new
},
:on_valid => ->(id) {
if inline?
@location_profile.refetch
render :json => @location_profile.to_hash if inline?
else
flash[:success] = t("location_profile._frontend.messages.created")
return redirect_to :controller => :location_profiles, :action => :new if params.has_key?(:plus_one)
redirect_to(:controller => :location_profiles, :action => :show, :id => id)
end
})
end
|
#current_record ⇒ Object
38
39
40
|
# File 'frontend/app/controllers/location_profiles_controller.rb', line 38
def current_record
@location_profile
end
|
#delete ⇒ Object
87
88
89
90
91
92
|
# File 'frontend/app/controllers/location_profiles_controller.rb', line 87
def delete
location_profile = JSONModel(:location_profile).find(params[:id])
location_profile.delete
redirect_to(:controller => :location_profiles, :action => :index, :deleted_uri => location_profile.uri)
end
|
#edit ⇒ Object
48
49
50
|
# File 'frontend/app/controllers/location_profiles_controller.rb', line 48
def edit
@location_profile = JSONModel(:location_profile).find(params[:id])
end
|
#index ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'frontend/app/controllers/location_profiles_controller.rb', line 22
def index
respond_to do |format|
format.html {
@search_data = Search.global(params_for_backend_search.merge({"facet[]" => FACETS}), "location_profile")
}
format.csv {
search_params = params_for_backend_search.merge({"facet[]" => FACETS})
search_params["type[]"] = "location_profile"
uri = "/repositories/#{session[:repo_id]}/search"
csv_response( uri, Search.build_filters(search_params), "#{I18n.t('location_profile._plural').downcase}." )
}
end
end
|
#new ⇒ Object
15
16
17
18
19
|
# File 'frontend/app/controllers/location_profiles_controller.rb', line 15
def new
@location_profile = JSONModel(:location_profile).new._always_valid!
render_aspace_partial :partial => "location_profiles/new" if inline?
end
|
#show ⇒ Object
43
44
45
|
# File 'frontend/app/controllers/location_profiles_controller.rb', line 43
def show
@location_profile = JSONModel(:location_profile).find(params[:id])
end
|
#typeahead ⇒ Object
95
96
97
|
# File 'frontend/app/controllers/location_profiles_controller.rb', line 95
def typeahead
render :json => Search.all(session[:repo_id], params_for_backend_search)
end
|
#update ⇒ Object
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'frontend/app/controllers/location_profiles_controller.rb', line 73
def update
handle_crud(:instance => :location_profile,
:model => JSONModel(:location_profile),
:obj => JSONModel(:location_profile).find(params[:id]),
:replace => true,
:on_invalid => ->() {
return render :action => :edit
},
:on_valid => ->(id) {
redirect_to(:controller => :location_profiles, :action => :show, :id => id)
})
end
|