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

Class Method Details

Parameters:

  • name (String)

Returns:

  • (String, nil)


153
154
155
# File 'app/lib/showcase_taxonomies.rb', line 153

def self.application_link_for(name)
  APPLICATION_URLS[name]
end

.application_optionsArray<String>

Visible labels for the snow-melt "explore by application" nav.

Returns:

  • (Array<String>)


111
112
113
# File 'app/lib/showcase_taxonomies.rb', line 111

def self.application_options
  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')

Parameters:

  • slug (String)

Returns:

  • (Array<Integer>)


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

Marketing URL for a given flooring label, or nil if unknown.

Parameters:

  • name (String)

Returns:

  • (String, nil)


118
119
120
# File 'app/lib/showcase_taxonomies.rb', line 118

def self.flooring_link_for(name)
  FLOORING_URLS[name]
end

.flooring_optionsArray<String>

Visible labels of the floor-heating flooring categories.

Returns:

  • (Array<String>)


85
86
87
# File 'app/lib/showcase_taxonomies.rb', line 85

def self.flooring_options
  FLOORING_URLS.keys
end

Parameters:

  • name (String)

Returns:

  • (String, nil)


130
131
132
# File 'app/lib/showcase_taxonomies.rb', line 130

def self.flooring_surface_link_for(name)
  COMBINED_URLS[name]
end

.flooring_surface_optionsArray<String>

Combined floor-heating + snow-melt + roof labels for showcase
filters that span all heating applications.

Returns:

  • (Array<String>)


98
99
100
# File 'app/lib/showcase_taxonomies.rb', line 98

def self.flooring_surface_options
  COMBINED_URLS.keys
end

Parameters:

  • name (String)

Returns:

  • (String, nil)


141
142
143
# File 'app/lib/showcase_taxonomies.rb', line 141

def self.roof_link_for(name)
  ROOF_URLS[name]
end

.roof_optionsArray<String>

Returns:

  • (Array<String>)


135
136
137
# File 'app/lib/showcase_taxonomies.rb', line 135

def self.roof_options
  ROOF_URLS.keys
end

Parameters:

  • name (String)

Returns:

  • (String, nil)


147
148
149
# File 'app/lib/showcase_taxonomies.rb', line 147

def self.room_link_for(name)
  ROOM_URLS[name]
end

.room_optionsArray<String>

Visible room labels for the floor-heating "explore by room"
nav.

Returns:

  • (Array<String>)


105
106
107
# File 'app/lib/showcase_taxonomies.rb', line 105

def self.room_options
  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.

Parameters:

  • room_name (String)

Returns:

  • (Array<String>)


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

Parameters:

  • name (String)

Returns:

  • (String, nil)


124
125
126
# File 'app/lib/showcase_taxonomies.rb', line 124

def self.surface_link_for(name)
  SURFACE_URLS[name]
end

.surface_optionsArray<String>

Visible labels of the snow-melt surface categories.

Returns:

  • (Array<String>)


91
92
93
# File 'app/lib/showcase_taxonomies.rb', line 91

def self.surface_options
  SURFACE_URLS.keys
end