Class: Www::DocumentCardComponent

Inherits:
ApplicationComponent show all
Defined in:
app/components/www/document_card_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(publication_code:, title:, image_url: nil, image_asset_id: nil, alt_text: nil, target: '_blank', rel: "noopener noreferrer", col_size: 'col-6 col-sm-4 col-md-3 col-xl-2 mt-4', image_asset_tag_options: {}, link: nil) ⇒ DocumentCardComponent

Returns a new instance of DocumentCardComponent.



4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/components/www/document_card_component.rb', line 4

def initialize(publication_code:, title:, image_url: nil, image_asset_id: nil, alt_text: nil, target: '_blank', rel: "noopener noreferrer", col_size: 'col-6 col-sm-4 col-md-3 col-xl-2 mt-4', image_asset_tag_options: {}, link: nil)
  @publication_code = publication_code
  @image_url = image_url
  @image_asset_id = image_asset_id
  @title = title
  @alt_text = alt_text || title
  @target = target
  @col_size = col_size
  @image_asset_tag_options = default_image_asset_tag_options.merge(image_asset_tag_options)
  @link = link
  super()
end