Class: ExtentCalculatorController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- ExtentCalculatorController
- Defined in:
- frontend/app/controllers/extent_calculator_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
#archivesspace, can_access?, permission_mappings, set_access_control
Instance Method Details
#report ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'frontend/app/controllers/extent_calculator_controller.rb', line 5 def report if params['record_uri'] results = JSONModel::HTTP::get_json("/extent_calculator", {'record_uri' => params['record_uri']}) extent = if params['referrer'] && params['referrer'].match('/edit(\#.*)?\Z') extent = JSONModel(:extent).new extent.number = results['total_extent'] if results['units'] units = results['volume'] ? 'cubic_' : 'linear_' units += results['units'] extent.extent_type = units end container_cardinality = results['container_count'] == 1 ? t('extent_calculator.container_summary_type._singular') : t('extent_calculator.container_summary_type._plural') extent.container_summary = "(#{results['container_count']} #{container_cardinality})" extent end render_aspace_partial :partial => "extent_calculator/show_calculation", :locals => {:results => results, :extent => extent} else render_aspace_partial :partial => "extent_calculator/no_object" end end |