Class: Www::SupportPageHeaderComponent

Inherits:
ApplicationComponent show all
Defined in:
app/components/www/support_page_header_component.rb

Overview

ViewComponent: renders the support page header block.

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(title:, sku:, introduction:, image_asset_id:, side_links: []) ⇒ void

Parameters:

  • title (String)

    heading text rendered in the header

  • sku (String)

    product SKU shown in the header

  • introduction (String)

    introductory copy under the title

  • image_asset_id (Integer, nil)

    asset used for the og:image default

  • side_links (Array<Hash>) (defaults to: [])

    links rendered beside the header



10
11
12
13
14
15
16
17
# File 'app/components/www/support_page_header_component.rb', line 10

def initialize(title:, sku:, introduction:, image_asset_id:, side_links: [])
  super()
  @title = title
  @sku = sku
  @introduction = introduction
  @image_asset_id = image_asset_id
  @side_links = side_links
end

Instance Method Details

#before_rendervoid

This method returns an undefined value.

Ensure pages using this header get a sensible default og:image.



21
22
23
24
# File 'app/components/www/support_page_header_component.rb', line 21

def before_render
  super
  helpers.page_og_image(@image_asset_id) if @image_asset_id.present?
end