Class: Www::RequestSmartplanSectionComponent

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

Constant Summary collapse

PRODUCT_CONFIGS =

Product type configurations

{
  floor_heating: {
    title: 'Free SmartPlan',
    icon: 'ruler-combined',
    application_type: 'Floor Heating',
    smartplan_link: '/floor-heating/electric-floor-heating-smartplan',
    rae_avatar: 'rae-radiant-floor-heating-guide-kppkd5',
    rae_quote: "I'll create a custom installation layout showing exactly where your heating elements go, plus a complete materials list with pricing.",
    carousel_slides: [
      { image: 'smartplan-installation-master-bathroom-tile-f1965d', alt: 'SmartPlan Installation Layout' },
      { image: 'smartplan-heated-area-master-bathroom-ef6148', alt: 'SmartPlan Heated Area Plan' },
      { image: 'smartplan-itemized-product-quote-master-bathroom-a9d64f', alt: 'SmartPlan Itemized Quote' }
    ]
  },
  snow_melting: {
    title: 'Free SmartPlan',
    icon: 'snowflake',
    application_type: 'Snow Melting',
    smartplan_link: '/snow-melting/electric-snow-melting-smartplan',
    rae_avatar: 'rae-radiant-floor-heating-guide-kppkd5',
    rae_quote: "I'll design a custom snow melting layout for your project, complete with cable spacing, electrical requirements, and a full quote.",
    carousel_slides: [
      { image: 'patio-snow-melting-example-design-mockup-beae21', alt: 'Patio Snow Melting SmartPlan Layout' },
      { image: 'snow-melting-cable-example-design-mockup-7e8f47', alt: 'Snow Melting Cable Design Layout' }
    ]
  }
}.freeze

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(product_type: :floor_heating, area_name: nil, project_link: nil, border: nil) ⇒ RequestSmartplanSectionComponent

Returns a new instance of RequestSmartplanSectionComponent.

Parameters:

  • product_type (Symbol) (defaults to: :floor_heating)

    :floor_heating or :snow_melting

  • area_name (String) (defaults to: nil)

    The room/area name (e.g., "bathroom", "driveway")

  • project_link (String) (defaults to: nil)

    Link to view projects for this area

  • border (Symbol, nil) (defaults to: nil)

    Border style: :top, :bottom, or :both



40
41
42
43
44
45
46
47
# File 'app/components/www/request_smartplan_section_component.rb', line 40

def initialize(product_type: :floor_heating, area_name: nil, project_link: nil, border: nil)
  super()
  @product_type = product_type.to_sym
  @config = PRODUCT_CONFIGS[@product_type] || PRODUCT_CONFIGS[:floor_heating]
  @area_name = area_name || 'project'
  @project_link = project_link
  @border = border
end

Instance Method Details

#application_typeObject



65
66
67
# File 'app/components/www/request_smartplan_section_component.rb', line 65

def application_type
  @config[:application_type]
end

#border_classesObject



49
50
51
52
53
54
55
# File 'app/components/www/request_smartplan_section_component.rb', line 49

def border_classes
  case @border
  when :top then 'border-top'
  when :bottom then 'border-bottom'
  when :both then 'border-top border-bottom'
  end
end


85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'app/components/www/request_smartplan_section_component.rb', line 85

def carousel_options
  {
    type: 'fade',
    perPage: 1,
    perMove: 1,
    arrows: true,
    pagination: true,
    autoplay: true,
    interval: 4000,
    pauseOnHover: true,
    rewind: true,
    speed: 600
  }
end


81
82
83
# File 'app/components/www/request_smartplan_section_component.rb', line 81

def carousel_slides
  @config[:carousel_slides]
end

#iconObject



61
62
63
# File 'app/components/www/request_smartplan_section_component.rb', line 61

def icon
  @config[:icon]
end

#rae_avatarObject



73
74
75
# File 'app/components/www/request_smartplan_section_component.rb', line 73

def rae_avatar
  @config[:rae_avatar]
end

#rae_quoteObject



77
78
79
# File 'app/components/www/request_smartplan_section_component.rb', line 77

def rae_quote
  @config[:rae_quote]
end

#show_project_link?Boolean

Returns:

  • (Boolean)


100
101
102
# File 'app/components/www/request_smartplan_section_component.rb', line 100

def show_project_link?
  @project_link.present?
end


69
70
71
# File 'app/components/www/request_smartplan_section_component.rb', line 69

def smartplan_link
  @config[:smartplan_link]
end

#titleObject



57
58
59
# File 'app/components/www/request_smartplan_section_component.rb', line 57

def title
  @config[:title]
end