Module: ShowcaseTaxonomies
- Defined in:
- app/lib/showcase_taxonomies.rb
Overview
Library code: showcase taxonomies.
Constant Summary collapse
- FLOORING_URLS =
Centralized mappings for flooring and surface types to CMS URLs
{ 'Tile, Marble, or Stone' => '/floor-heating/tile-marble-or-stone', 'Luxury Vinyl' => '/floor-heating/luxury-vinyl-tiles', 'Laminate' => '/floor-heating/laminate', 'Engineered Wood' => '/floor-heating/engineered-wood', 'Nailed Hardwood' => '/floor-heating/nailed-hardwood', 'Bamboo' => '/floor-heating/bamboo', 'Carpet' => '/floor-heating/carpet', 'Concrete' => '/floor-heating/concrete' }.freeze
- SURFACE_URLS =
Surface urls.
{ 'Asphalt' => '/snow-melting/asphalt', 'Concrete' => '/snow-melting/concrete', 'Pavers / Stone' => '/snow-melting/heated-pavers-and-stone' }.freeze
- ROOF_URLS =
Roof urls.
{ 'Metal Roofs' => '/roof-and-gutter-deicing/metal-roof', 'Asphalt Shingle Roofs' => '/roof-and-gutter-deicing/asphalt-shingle-roof', 'Slate Shingle Roofs' => '/roof-and-gutter-deicing/slate-shingle-roof' }.freeze
- COMBINED_URLS =
Combined urls.
FLOORING_URLS .merge(SURFACE_URLS) .merge(ROOF_URLS) .freeze
- ROOM_URLS =
Floor Heating: Explore by Room
{ 'Bathroom & Shower' => '/floor-heating/bathroom', 'Kitchen' => '/floor-heating/kitchen', 'Living Room' => '/floor-heating/living-room', 'Bedroom' => '/floor-heating/bedroom', 'Basement' => '/floor-heating/basement', 'Laundry & Mudroom' => '/floor-heating/laundry-mudroom', 'Sunroom' => '/floor-heating/sunroom', 'Tiny Houses' => '/floor-heating/tiny-house' }.freeze
- APPLICATION_URLS =
Snow Melting: Explore by Application
{ 'Driveways' => '/snow-melting/heated-driveway', 'Walkways & Paths' => '/snow-melting/heated-walkway-path', 'Outdoor Stairs' => '/snow-melting/outdoor-stairs', 'Ramps' => '/snow-melting/accessibility-ramp-deicing', 'Patios' => '/snow-melting/heated-concrete-patio' }.freeze
- FLOOR_TYPE_SLUG_TO_IDS =
Map marketing URL slugs to FloorType ids in the DB
Use this for filtering Showcase by specific floor types on landing pages { # Floor Heating landing pages 'luxury-vinyl-tiles' => [10], # Resilients, Vinyl and LVT 'tile-marble-or-stone' => [3], # Tile, Marble or Stone 'engineered-wood' => [4, 15, 16], # Engineered (floating, glued, nailed) 'laminate' => [6, 17, 18], # Laminate variants 'nailed-hardwood' => [11], # Hardwood (nailed) 'bamboo' => [1, 13, 14], # Bamboo (nailed, floating, glued) 'carpet' => [2, 23], # Carpet stretch-in and glued 'concrete' => [5] # Exposed concrete (new pour) }.freeze
- ROOM_NAME_TO_TYPE_IDS =
Map visible room names to RoomType ids for Showcase filtering
{ 'Bathroom & Shower' => [2, 19], 'Kitchen' => [10], 'Living Room' => [12], 'Bedroom' => [4], 'Basement' => [1], 'Laundry & Mudroom' => [11, 14], 'Sunroom' => [17], 'Tiny Houses' => [18] # No explicit tiny-house room type; use Other }.freeze
Class Method Summary collapse
- .application_link_for(name) ⇒ String?
-
.application_options ⇒ Array<String>
Visible labels for the snow-melt "explore by application" nav.
-
.floor_type_ids_for_slug(slug) ⇒ Array<Integer>
Resolve
FloorTypeids for a given marketing URL slug (e.g., 'luxury-vinyl-tiles'). -
.flooring_link_for(name) ⇒ String?
Marketing URL for a given flooring label, or nil if unknown.
-
.flooring_options ⇒ Array<String>
Visible labels of the floor-heating flooring categories.
- .flooring_surface_link_for(name) ⇒ String?
-
.flooring_surface_options ⇒ Array<String>
Combined floor-heating + snow-melt + roof labels for showcase filters that span all heating applications.
- .roof_link_for(name) ⇒ String?
- .roof_options ⇒ Array<String>
- .room_link_for(name) ⇒ String?
-
.room_options ⇒ Array<String>
Visible room labels for the floor-heating "explore by room" nav.
-
.room_type_ids_for(room_name) ⇒ Array<String>
RoomTypeids matching a visible room label, returned as strings for use in URL params. - .surface_link_for(name) ⇒ String?
-
.surface_options ⇒ Array<String>
Visible labels of the snow-melt surface categories.
Class Method Details
.application_link_for(name) ⇒ String?
153 154 155 |
# File 'app/lib/showcase_taxonomies.rb', line 153 def self.application_link_for(name) APPLICATION_URLS[name] end |
.application_options ⇒ Array<String>
Visible labels for the snow-melt "explore by application" nav.
111 112 113 |
# File 'app/lib/showcase_taxonomies.rb', line 111 def self. APPLICATION_URLS.keys end |
.floor_type_ids_for_slug(slug) ⇒ Array<Integer>
Resolve FloorType ids for a given marketing URL slug (e.g., 'luxury-vinyl-tiles')
168 169 170 |
# File 'app/lib/showcase_taxonomies.rb', line 168 def self.floor_type_ids_for_slug(slug) Array(FLOOR_TYPE_SLUG_TO_IDS[slug.to_s.strip]).map(&:to_i) end |
.flooring_link_for(name) ⇒ String?
Marketing URL for a given flooring label, or nil if unknown.
118 119 120 |
# File 'app/lib/showcase_taxonomies.rb', line 118 def self.flooring_link_for(name) FLOORING_URLS[name] end |
.flooring_options ⇒ Array<String>
Visible labels of the floor-heating flooring categories.
85 86 87 |
# File 'app/lib/showcase_taxonomies.rb', line 85 def self. FLOORING_URLS.keys end |
.flooring_surface_link_for(name) ⇒ String?
130 131 132 |
# File 'app/lib/showcase_taxonomies.rb', line 130 def self.flooring_surface_link_for(name) COMBINED_URLS[name] end |
.flooring_surface_options ⇒ Array<String>
Combined floor-heating + snow-melt + roof labels for showcase
filters that span all heating applications.
98 99 100 |
# File 'app/lib/showcase_taxonomies.rb', line 98 def self. COMBINED_URLS.keys end |
.roof_link_for(name) ⇒ String?
141 142 143 |
# File 'app/lib/showcase_taxonomies.rb', line 141 def self.roof_link_for(name) ROOF_URLS[name] end |
.roof_options ⇒ Array<String>
135 136 137 |
# File 'app/lib/showcase_taxonomies.rb', line 135 def self. ROOF_URLS.keys end |
.room_link_for(name) ⇒ String?
147 148 149 |
# File 'app/lib/showcase_taxonomies.rb', line 147 def self.room_link_for(name) ROOM_URLS[name] end |
.room_options ⇒ Array<String>
Visible room labels for the floor-heating "explore by room"
nav.
105 106 107 |
# File 'app/lib/showcase_taxonomies.rb', line 105 def self. ROOM_URLS.keys end |
.room_type_ids_for(room_name) ⇒ Array<String>
RoomType ids matching a visible room label, returned as
strings for use in URL params. Returns [] for unknown rooms.
161 162 163 |
# File 'app/lib/showcase_taxonomies.rb', line 161 def self.room_type_ids_for(room_name) Array(ROOM_NAME_TO_TYPE_IDS[room_name]).map(&:to_s) end |
.surface_link_for(name) ⇒ String?
124 125 126 |
# File 'app/lib/showcase_taxonomies.rb', line 124 def self.surface_link_for(name) SURFACE_URLS[name] end |
.surface_options ⇒ Array<String>
Visible labels of the snow-melt surface categories.
91 92 93 |
# File 'app/lib/showcase_taxonomies.rb', line 91 def self. SURFACE_URLS.keys end |