Class: Www::CustomMatsPresenter

Inherits:
BasePresenter
  • Object
show all
Includes:
ApplicationHelper, Memery
Defined in:
app/presenters/www/custom_mats_presenter.rb

Overview

Presenter for the TempZone Custom Mats static product page.
This page doesn't have actual product variants but displays product-like
information with a gallery, sections, FAQs, and documents.

Uses the tag system to pull in related content:

  • Videos tagged with the page tag
  • Publications tagged with the page tag
  • Posts tagged with the page tag

Constant Summary collapse

PAGE_PATH =

Page path used for generating the page tag (e.g., 'for-floor-heating-custom-mats-page')

'floor-heating/custom-mats'
IDENTIFIER =

Static page identifier used for gallery IDs, etc.

'tempzone-custom-mats'
PRODUCT_LINE_SLUG_LTREE =

Product line slug path (slug_ltree) for FAQs and other product-line-specific content

LtreePaths::PL_FLOOR_HEATING_TEMPZONE_CUSTOM_MAT
[
  { id: 5680, title: 'TempZone Custom Mat Close Up' },
  { id: 7178, title: 'TempZone Custom Mat on Thinset' },
  { id: 'tempzone-custom-mat-unrolled-c39436', title: 'TempZone Custom Mat Unrolled' },
  { id: 5681, title: 'Custom TempZone Heating Mat Installation for Bathroom Floor' },
  { id: 5675, title: 'TempZone Custom Mat with Floor Sensor' },
  { id: 23_466, title: 'TempZone Custom Mat SmartPlan' }
].freeze
%w[
  tempzone-custom-mat-floor-heat-system-intro
  how-to-install-tempzone-custom-mat
].freeze

Constants included from SeoHelper

SeoHelper::AWARDS, SeoHelper::CA_ADDRESS, SeoHelper::CA_BUSINESS_HOURS, SeoHelper::CA_CONTACT_POINT, SeoHelper::CA_CURRENCIES, SeoHelper::CA_DESCRIPTION, SeoHelper::CA_FOUNDING_DATE, SeoHelper::CA_GLOBAL_LOCATION_NUMBER, SeoHelper::CA_LEGAL_NAME, SeoHelper::CA_LOCAL_BUSINESS, SeoHelper::CA_ONLINE_STORE, SeoHelper::CA_RETURN_POLICY, SeoHelper::CA_SALES_DEPARTMENT, SeoHelper::CA_SERVICE_AREA, SeoHelper::CA_URL, SeoHelper::CA_VAT_ID, SeoHelper::CA_WAREHOUSE_DEPARTMENT, SeoHelper::CA_WAREHOUSE_HOURS, SeoHelper::COMPANY_EMAIL, SeoHelper::COMPANY_LOGO, SeoHelper::COMPANY_NAME, SeoHelper::COMPANY_SLOGAN, SeoHelper::EXPERTISE, SeoHelper::FAX_NUMBER, SeoHelper::GS1_COMPANY_PREFIX, SeoHelper::ISO6523_CODE, SeoHelper::PAYMENT_METHODS, SeoHelper::PHONE_NUMBER, SeoHelper::PRIMARY_NAICS, SeoHelper::REFUND_TYPE, SeoHelper::RETURN_FEES, SeoHelper::RETURN_METHOD, SeoHelper::RETURN_POLICY_CATEGORY, SeoHelper::SECONDARY_NAICS, SeoHelper::SOCIAL_PROFILES, SeoHelper::US_ADDRESS, SeoHelper::US_BUSINESS_HOURS, SeoHelper::US_CONTACT_POINT, SeoHelper::US_CURRENCIES, SeoHelper::US_DESCRIPTION, SeoHelper::US_FOUNDING_DATE, SeoHelper::US_GLOBAL_LOCATION_NUMBER, SeoHelper::US_IMAGE, SeoHelper::US_LEGAL_NAME, SeoHelper::US_LOCAL_BUSINESS, SeoHelper::US_ONLINE_STORE, SeoHelper::US_RETURN_POLICY, SeoHelper::US_SALES_DEPARTMENT, SeoHelper::US_SERVICE_AREA, SeoHelper::US_TAX_ID, SeoHelper::US_URL, SeoHelper::US_WAREHOUSE_DEPARTMENT, SeoHelper::US_WAREHOUSE_HOURS

Constants included from IconHelper

IconHelper::CUSTOM_ICON_MAP, IconHelper::CUSTOM_SVG_DIR, IconHelper::DEFAULT_FAMILY

Instance Method Summary collapse

Methods included from ApplicationHelper

#better_number_to_currency, #check_force_logout, #check_or_cross, #check_or_times, #error_messages, #general_disclaimer_on_product_installation_and_local_codes, #gridjs_from_html_table, #gridjs_table, #is_wy_ip, #line_break, #parent_layout, #pass_or_fail, #render_error_messages_list, #render_video_card, #resolved_auth_form_turbo_frame, #return_path_or, #safe_css_color, #set_return_path_if_present, #set_section_if_present, #tab_frame_id, #to_underscore, #track_page?, #turbo_section_wrapper, #turbo_tabs_request?, #url_on_same_domain_as_request, #widget_index_daily_focus_index_path, #working_hours?, #yes_or_no, #yes_or_no_highlighted, #yes_or_no_with_check_or_cross, #youtube_video

Methods included from UppyUploaderHelper

#file_uploader, #image_uploader, #large_file_uploader_s3, #lead_sketch_uploader, #rma_image_uploader, #rma_image_uploader_s3, #uppy_uploader, #video_uploader

Methods included from ImagesHelper

#image_asset_tag, #image_asset_url

Methods included from SeoHelper

#add_page_schema, #canada?, #company_social_links, #ensure_context_json, #json_ld_script_tag, #local_business_schema, #online_store_id, #online_store_schema, #page_main_entity, #page_main_entity_json, #render_auto_collection_page_schema, #render_collection_page_schema, #render_local_business_schema, #render_online_store_schema, #render_page_schemas, #render_page_video_schemas, #render_webpage_schema, #render_webpage_schema_with_collections, #usa?

Methods included from UrlsHelper

#catalog_breadcrumb_links, #catalog_link, #catalog_link_for_product_line, #catalog_link_for_sku, #cms_link, #delocalized_path, #path_to_sales_product_sku, #path_to_sales_product_sku_for_product_line, #path_to_sales_product_sku_for_product_line_slug, #product_line_from_catalog_link, #protocol_neutral_url, #sanitize_external_url, #valid_external_url?

Methods included from IconHelper

#account_nav_icon, #fa_icon, #star_rating_html

Constructor Details

#initialize(view = nil) ⇒ CustomMatsPresenter

Returns a new instance of CustomMatsPresenter.



41
42
43
44
# File 'app/presenters/www/custom_mats_presenter.rb', line 41

def initialize(view = nil)
  @view = view || ApplicationController.helpers
  super(nil, @view)
end

Instance Method Details



74
75
76
77
78
79
# File 'app/presenters/www/custom_mats_presenter.rb', line 74

def breadcrumb_links_array
  [
    { name: 'Radiant Floor Heating', url: h.cms_link('/floor-heating') },
    { name: 'TempZone™ Custom Mats' }
  ]
end


134
135
136
# File 'app/presenters/www/custom_mats_presenter.rb', line 134

def carousel_assets
  gallery_images + gallery_videos
end

#controls_and_accessoriesObject



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'app/presenters/www/custom_mats_presenter.rb', line 153

def controls_and_accessories
  [
    {
      title: 'Floor Heating Controls',
      image_slug: 'nspire-touch-udg4-4999-wy-logo-front-7c2048',
      url: h.cms_link('/floor-heating/thermostats')
    },
    {
      title: 'Underlayment',
      image_slug: 'underlayment-sample-c1ece5',
      url: h.cms_link('/floor-heating/underlayment')
    },
    {
      title: 'Circuit Check',
      image_slug: 'warmlyyours-circuit-check-amazon-ae1e2c',
      url: h.catalog_link(::Item.find_by!(sku: 'SS-01'))
    },
    {
      title: 'Electrical Rough-In Kits for Thermostats',
      image_slug: 'floor-heating-rough-in-kits-02ad97',
      url: h.catalog_link(::ProductLine.find_by!(slug_ltree: LtreePaths::PL_FLOOR_HEATING_ROUGH_IN_KITS))
    }
  ]
end

#description_htmlObject



81
82
83
84
85
86
87
# File 'app/presenters/www/custom_mats_presenter.rb', line 81

def description_html
  <<~HTML.html_safe
    <p>Our <a href="#{h.cms_link('/posts/WarmlyYours-Upgrades-Custom-Floor-Heating-Mats-3058')}">recently upgraded custom-sized electric heating mats</a> arrive in one piece, making for a fast, simple installation — you don't have to make any cuts or trims. TempZone™ Custom Mats are commonly used beneath tile or stone flooring. These floor mats provide 12-15 watts/sq. ft., depending on the room size, and evenly distribute heat for full room coverage.</p>
    <p>The mats feature a layered construction with the heating element sandwiched between two durable layers of fabric. WarmlyYours will help you design the perfect floor-heating system with free overnight design services. Each custom mat is made to order and is non-refundable.</p>
    <p>Please allow for <span class="fw-semibold">at least 8 to 10 business days</span> after the point of purchase for this customized item to ship.</p>
  HTML
end

#documentsObject



178
179
180
181
182
183
184
185
186
187
# File 'app/presenters/www/custom_mats_presenter.rb', line 178

def documents
  [
    { name: 'TempZone™ Custom Mat Installation Manual', publication_sku: 'TZ-CUSTOM-FIT-MANUAL' },
    { name: 'TempZone™ Custom Mat Materials & Tools Checklist', publication_sku: 'TEMPZONE-CUSTOM-MAT-MATERIALS-AND-TOOLS-CHECKLIST' },
    { name: 'TempZone™ Custom Mat Specification Sheet', publication_sku: 'TEMPZONE-CUSTOM-MAT-SPEC-SHEET' },
    { name: 'TempZone™ Custom Mat Sell Sheet', publication_sku: 'TEMPZONE-CUSTOM-MAT-SELL-SHEET' },
    { name: 'nSpiration Series Thermostat Wiring Diagram for TempZone™ Custom Mats', publication_sku: 'OJ-TZ-SINGLE-MULTI-WD' },
    { name: 'Mysa WiFi Thermostat Wiring Diagram for TempZone™ Custom Mats', publication_sku: 'MYSA-WI-FI-THERMOSTAT-TEMPZONE-SINGLE-CONDUCTOR-ROLL-MULTI-MAT-WIRING-DIAGRAM' }
  ]
end

#documents_section?Boolean

Combined check for documents section (publications + posts)

Returns:

  • (Boolean)


226
227
228
# File 'app/presenters/www/custom_mats_presenter.rb', line 226

def documents_section?
  publications? || posts?
end

#example_projectObject



139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'app/presenters/www/custom_mats_presenter.rb', line 139

def example_project
  {
    image_slug: 'tempzone-custom-mat-smartplan-a3ebb5',
    flooring: 'Tile, Marble or Stone',
    subfloor: 'Wood',
    room_type: 'Bathroom',
    coverage: '100%',
    price: '$729.00 MSRP (USD)',
    voltage: '120 VAC',
    wattage: '376 Watts',
    operating_cost: '2 cents per hour'
  }
end

#faqsObject



189
190
191
# File 'app/presenters/www/custom_mats_presenter.rb', line 189

def faqs
  Article.faqs.published.for_product_line_url_with_descendants(PRODUCT_LINE_SLUG_LTREE).with_votes
end

#featuresObject



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'app/presenters/www/custom_mats_presenter.rb', line 89

def features
  [
    {
      title: 'Maximum Coverage',
      description: 'Full coverage for any size space, such as bathrooms, kitchens, living rooms, or basements.'
    },
    {
      title: 'Easy to Install',
      description: 'Easiest installation, no cut and turns required.'
    },
    {
      title: 'Clean Heat',
      description: "Doesn't disturb pollen, dust or other allergens like forced-air systems."
    },
    {
      title: 'Safe',
      description: 'ETL listed'
    }
  ]
end


110
111
112
113
114
115
116
117
118
# File 'app/presenters/www/custom_mats_presenter.rb', line 110

def gallery_images
  GALLERY_IMAGES.map do |img_data|
    OpenStruct.new(
      id: img_data[:id],
      title: img_data[:title],
      type: :image
    )
  end
end


120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'app/presenters/www/custom_mats_presenter.rb', line 120

def gallery_videos
  GALLERY_VIDEOS.filter_map do |slug|
    video = Video.find_by(slug: slug)
    next unless video

    OpenStruct.new(
      video: video,
      slug: slug,
      title: video.seo_title,
      type: :video
    )
  end
end

#identifierObject



54
55
56
# File 'app/presenters/www/custom_mats_presenter.rb', line 54

def identifier
  IDENTIFIER
end

#learn_more_urlObject



293
294
295
# File 'app/presenters/www/custom_mats_presenter.rb', line 293

def learn_more_url
  h.cms_link('/floor-heating')
end

#page_descriptionObject



70
71
72
# File 'app/presenters/www/custom_mats_presenter.rb', line 70

def page_description
  'Offering electric floor heating options for under tile, stone, hardwood and carpet, WarmlyYours makes houses into homes with floor warming systems.'
end

#page_tagObject

The page tag for this page, following the convention:
'for-' + page_path.tr('/', '-').parameterize + '-page'
e.g., 'for-floor-heating-custom-mats-page'



49
50
51
# File 'app/presenters/www/custom_mats_presenter.rb', line 49

def page_tag
  DigitalAsset.page_tag_for(PAGE_PATH)
end

#page_titleObject



66
67
68
# File 'app/presenters/www/custom_mats_presenter.rb', line 66

def page_title
  'Custom Electric Mats | Floor Heating Systems | Electric Heated Floor Warming'
end

#postsObject

Blog posts tagged with the page tag



216
217
218
# File 'app/presenters/www/custom_mats_presenter.rb', line 216

def posts
  Post.published.tagged_with(page_tag).order(published_at: :desc)
end

#posts?Boolean

Returns:

  • (Boolean)


221
222
223
# File 'app/presenters/www/custom_mats_presenter.rb', line 221

def posts?
  posts.any?
end

#product_sample_urlObject



284
285
286
# File 'app/presenters/www/custom_mats_presenter.rb', line 284

def product_sample_url
  h.cms_link('/contact/product-sample')
end

#publicationsObject

Publications tagged with the page tag
Uses the same helper pattern as other landing pages



206
207
208
# File 'app/presenters/www/custom_mats_presenter.rb', line 206

def publications
  h.find_publications_by_tag_in_current_locale(page_tag)
end

#publications?Boolean

Returns:

  • (Boolean)


211
212
213
# File 'app/presenters/www/custom_mats_presenter.rb', line 211

def publications?
  publications.any?
end

#quote_builder_urlObject



280
281
282
# File 'app/presenters/www/custom_mats_presenter.rb', line 280

def quote_builder_url
  h.cms_link('/quote')
end

#reviews_urlObject



297
298
299
# File 'app/presenters/www/custom_mats_presenter.rb', line 297

def reviews_url
  h.cms_link('/floor-heating/reviews')
end

#sectionsObject

Sections configuration for the navigation and content
Only includes sections that have content



232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'app/presenters/www/custom_mats_presenter.rb', line 232

def sections
  s = {}

  s[:description] = {
    nav_name: 'Description',
    section_name: 'Description'
  }

  s[:'example-project'] = {
    nav_name: 'Example Project',
    section_name: 'Example Project'
  }

  s[:controls] = {
    nav_name: 'Controls & Accessories',
    section_name: 'Controls & Accessories'
  }

  if tagged_videos?
    s[:videos] = {
      nav_name: 'Videos',
      section_name: 'Videos'
    }
  end

  if faqs.any?
    s[:faqs] = {
      nav_name: 'FAQs',
      section_name: 'Frequently Asked Questions'
    }
  end

  if documents_section?
    s[:documents] = {
      nav_name: 'Documents',
      section_name: 'Documents & Articles'
    }
  end

  s[:reviews] = {
    nav_name: 'Reviews',
    section_name: 'Customer Reviews'
  }

  s
end

#subtitleObject



62
63
64
# File 'app/presenters/www/custom_mats_presenter.rb', line 62

def subtitle
  'Electric Custom Mats for Heated Floors'
end

#support_urlObject



288
289
290
291
# File 'app/presenters/www/custom_mats_presenter.rb', line 288

def support_url
  pl = ProductLine.find_by(slug_ltree: PRODUCT_LINE_SLUG_LTREE)
  pl ? h.catalog_link(pl, section: :support) : h.cms_link('/support')
end

#tagged_videosObject

Videos tagged with the page tag (for video section, not gallery)



195
196
197
# File 'app/presenters/www/custom_mats_presenter.rb', line 195

def tagged_videos
  Video.public_videos.tagged_with(page_tag).order(created_at: :desc)
end

#tagged_videos?Boolean

Returns:

  • (Boolean)


200
201
202
# File 'app/presenters/www/custom_mats_presenter.rb', line 200

def tagged_videos?
  tagged_videos.any?
end

#titleObject



58
59
60
# File 'app/presenters/www/custom_mats_presenter.rb', line 58

def title
  'TempZone™ Custom Mats'
end