Class: Www::FloorCompatibilityTableComponent

Inherits:
ApplicationComponent show all
Includes:
ActionView::Helpers::UrlHelper
Defined in:
app/components/www/floor_compatibility_table_component.rb

Overview

Renders a floor type compatibility matrix for heating systems.
Data is sourced from the FloorHeatingCompatibility module.

Examples:

Full matrix with all systems (for /floor-heating), rendered from a view

render Www::FloorCompatibilityTableComponent.new(category: :all)

Cable systems only (for /floor-heating/heating-cable)

render Www::FloorCompatibilityTableComponent.new(
  category: :cable,
  description: "Floor heating cables are compatible with a variety of flooring types."
)

Mat systems only (for /floor-heating/heated-floor-mat)

render Www::FloorCompatibilityTableComponent.new(category: :mat)

Instance Method Summary collapse

Methods inherited from ApplicationComponent

#cms_link, #fetch_or_fallback, #image_asset_tag, #image_tag, #number_to_currency, #number_with_delimiter, #post_path, #post_url, #strip_tags

Constructor Details

#initialize(category: :all, title: 'Floor Type Compatibility', description: nil, show_section_header: true, compact: false) ⇒ FloorCompatibilityTableComponent

Returns a new instance of FloorCompatibilityTableComponent.

Parameters:

  • category (Symbol) (defaults to: :all)

    :all (default), :cable, or :mat — filters which heating systems to show

  • title (String) (defaults to: 'Floor Type Compatibility')

    section title

  • description (String, nil) (defaults to: nil)

    introductory paragraph (optional; falls back to #default_description)

  • show_section_header (Boolean) (defaults to: true)

    whether to render the section header

  • compact (Boolean) (defaults to: false)

    if true, hides the installation column for simpler display



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'app/components/www/floor_compatibility_table_component.rb', line 25

def initialize(
  category: :all,
  title: 'Floor Type Compatibility',
  description: nil,
  show_section_header: true,
  compact: false
)
  super()
  @category = category
  @title = title
  @description = description
  @show_section_header = show_section_header
  @compact = compact
end