Class: Www::BlogFaqItemComponent

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

Overview

Simple card-style FAQ item for use in blog posts via the faq % liquid tag.
Unlike FaqItemComponent (accordion style), this renders as a static card.

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(article_faq:, preview_mode: false) ⇒ BlogFaqItemComponent

Returns a new instance of BlogFaqItemComponent.

Parameters:

  • article_faq (Article)

    FAQ article record

  • preview_mode (Boolean) (defaults to: false)

    Whether to render draft content



8
9
10
11
12
# File 'app/components/www/blog_faq_item_component.rb', line 8

def initialize(article_faq:, preview_mode: false)
  super()
  @article_faq = article_faq
  @preview_mode = preview_mode
end

Instance Method Details

#render?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'app/components/www/blog_faq_item_component.rb', line 14

def render?
  @article_faq.present?
end