Class: Www::SupportPageHeaderComponent

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

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: []) ⇒ SupportPageHeaderComponent

Returns a new instance of SupportPageHeaderComponent.



2
3
4
5
6
7
8
9
# File 'app/components/www/support_page_header_component.rb', line 2

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_renderObject

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



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

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