Class: SpaceCalculatorController
Instance Method Summary
collapse
#archivesspace, can_access?, permission_mappings, set_access_control
Instance Method Details
#calculate ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'frontend/app/controllers/space_calculator_controller.rb', line 19
def calculate
if params[:container_profile]
@container_profile_ref = params[:container_profile][:ref]
end
if params[:location]
@location_refs = ASUtils.wrap(params[:location]).map {|loc| loc[:ref]}.flatten.compact
if @container_profile_ref && @location_refs
@results = JSONModel::HTTP.get_json("/space_calculator/by_location", {
'container_profile_uri' => @container_profile_ref,
'location_uris[]' => @location_refs
})
end
elsif params[:building]
building = params[:building]
floor = params[:floor].blank? ? nil : params[:floor]
room = params[:room].blank? ? nil : params[:room]
area = params[:area].blank? ? nil : params[:area]
@by_building = true
if @container_profile_ref
@results = JSONModel::HTTP.get_json("/space_calculator/by_building", {
'container_profile_uri' => @container_profile_ref,
'building' => building,
'floor' => floor,
'room' => room,
'area' => area,
})
end
end
@selectable = params[:selectable] == "true"
render_aspace_partial :partial => "space_calculator/results"
end
|
#show ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'frontend/app/controllers/space_calculator_controller.rb', line 5
def show
@container_profile_ref = params[:container_profile_ref]
unless @container_profile_ref.blank?
@container_profile = JSONModel(:container_profile).find_by_uri(@container_profile_ref)
end
@buildings = JSONModel::HTTP.get_json("/space_calculator/buildings")
@selectable = params[:selectable] == "true"
render_aspace_partial :partial => "space_calculator/form"
end
|