Class: Www::RequestSmartplanSectionComponent
- Inherits:
-
ApplicationComponent
- Object
- ViewComponent::Base
- ApplicationComponent
- Www::RequestSmartplanSectionComponent
- Includes:
- ActionView::Helpers::TagHelper, ActionView::Helpers::UrlHelper
- Defined in:
- app/components/www/request_smartplan_section_component.rb
Overview
ViewComponent: renders the request smartplan section block.
Constant Summary collapse
- PRODUCT_CONFIGS =
Product type configurations
{ floor_heating: { title: 'Free SmartPlan', icon: 'ruler-combined', application_type: 'Floor Heating', smartplan_link: '/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/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
-
#application_type ⇒ String
Human-readable application type (e.g., "Floor Heating").
-
#border_classes ⇒ String?
Bootstrap border classes for the configured border style.
-
#carousel_options ⇒ Hash
Splide carousel options passed to the carousel element.
-
#carousel_slides ⇒ Array<Hash>
Carousel slide definitions (:image and :alt keys).
-
#icon ⇒ String
Font Awesome icon name for the configured product type.
-
#initialize(product_type: :floor_heating, area_name: nil, project_link: nil, border: nil) ⇒ RequestSmartplanSectionComponent
constructor
A new instance of RequestSmartplanSectionComponent.
-
#rae_avatar ⇒ String
Image key for Rae's avatar.
-
#rae_quote ⇒ String
Rae's pitch quote for the configured product type.
-
#show_project_link? ⇒ Boolean
Whether the "view projects" link should be rendered.
-
#smartplan_link ⇒ String
Path to the SmartPlan request page for this product type.
-
#title ⇒ String
Section title for the configured product type.
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.
41 42 43 44 45 46 47 48 |
# File 'app/components/www/request_smartplan_section_component.rb', line 41 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_type ⇒ String
Returns human-readable application type (e.g., "Floor Heating").
70 71 72 |
# File 'app/components/www/request_smartplan_section_component.rb', line 70 def application_type @config[:application_type] end |
#border_classes ⇒ String?
Returns Bootstrap border classes for the configured border style.
51 52 53 54 55 56 57 |
# File 'app/components/www/request_smartplan_section_component.rb', line 51 def border_classes case @border when :top then 'border-top' when :bottom then 'border-bottom' when :both then 'border-top border-bottom' end end |
#carousel_options ⇒ Hash
Returns Splide carousel options passed to the carousel element.
95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'app/components/www/request_smartplan_section_component.rb', line 95 def { type: 'fade', perPage: 1, perMove: 1, arrows: true, pagination: true, autoplay: true, interval: 4000, pauseOnHover: true, rewind: true, speed: 600 } end |
#carousel_slides ⇒ Array<Hash>
Returns carousel slide definitions (:image and :alt keys).
90 91 92 |
# File 'app/components/www/request_smartplan_section_component.rb', line 90 def @config[:carousel_slides] end |
#icon ⇒ String
Returns Font Awesome icon name for the configured product type.
65 66 67 |
# File 'app/components/www/request_smartplan_section_component.rb', line 65 def icon @config[:icon] end |
#rae_avatar ⇒ String
Returns image key for Rae's avatar.
80 81 82 |
# File 'app/components/www/request_smartplan_section_component.rb', line 80 def rae_avatar @config[:rae_avatar] end |
#rae_quote ⇒ String
Returns Rae's pitch quote for the configured product type.
85 86 87 |
# File 'app/components/www/request_smartplan_section_component.rb', line 85 def rae_quote @config[:rae_quote] end |
#show_project_link? ⇒ Boolean
Returns whether the "view projects" link should be rendered.
111 112 113 |
# File 'app/components/www/request_smartplan_section_component.rb', line 111 def show_project_link? @project_link.present? end |
#smartplan_link ⇒ String
Returns path to the SmartPlan request page for this product type.
75 76 77 |
# File 'app/components/www/request_smartplan_section_component.rb', line 75 def smartplan_link @config[:smartplan_link] end |
#title ⇒ String
Returns section title for the configured product type.
60 61 62 |
# File 'app/components/www/request_smartplan_section_component.rb', line 60 def title @config[:title] end |