Module: BuildingsHelper
- Defined in:
- app/helpers/buildings_helper.rb
Overview
Helper module for working with buildings in your application.
Class Method Summary collapse
-
.building_types ⇒ Hash
Provides a list of building types with their corresponding codes and descriptions.
-
.get_building_name(building_id) ⇒ String
Gets the name of a building based on its ID.
-
.new_nav_list(property_id) ⇒ Hash
Generates a navigation list for creating new buildings within a property.
-
.show_nav_list(property_id) ⇒ Hash
Generates a navigation list for displaying buildings within a property.
Class Method Details
.building_types ⇒ Hash
Provides a list of building types with their corresponding codes and descriptions.
23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/helpers/buildings_helper.rb', line 23 def self.building_types { '-1-1' => '', '100' => 'Common Building', '150' => 'Duplex', '200' => 'Lowrise/Garden Apartment', '300' => 'Mid/High Rise', '400' => 'Row/Townhouse', '500' => 'Single Family ' } end |
.get_building_name(building_id) ⇒ String
Gets the name of a building based on its ID.
10 11 12 13 14 15 16 17 18 |
# File 'app/helpers/buildings_helper.rb', line 10 def self.get_building_name(building_id) building = Building.where(old_id: building_id) .or(Building.where(id: building_id)).first if building return building.building_name else return '' end end |
.new_nav_list(property_id) ⇒ Hash
Generates a navigation list for creating new buildings within a property.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'app/helpers/buildings_helper.rb', line 39 def self.new_nav_list(property_id) { 1 => { label: 'Properties', url: '/admin/properties/' }, 2 => { url: '/admin/properties/' + property_id.to_s, label: 'Buildings' }, 3 => { label: 'New Buildings' } } end |
.show_nav_list(property_id) ⇒ Hash
Generates a navigation list for displaying buildings within a property.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'app/helpers/buildings_helper.rb', line 59 def self.show_nav_list(property_id) { 1 => { label: 'Properties', url: '/admin/properties/' }, 2 => { url: '/admin/properties/' + property_id.to_s, label: 'Buildings' }, 3 => { label: 'Units' } } end |