Class: Www::SupportArticlePresenter

Inherits:
BasePresenter
  • Object
show all
Defined in:
app/presenters/www/support_article_presenter.rb

Overview

Presenter: support article presenter.

Instance Method Summary collapse

Instance Method Details

Breadcrumb trail for the support article page.

Parameters:

  • pl (ProductLine, nil) (defaults to: nil)

    product line to anchor the breadcrumb
    (defaults to the article's first product line)

Returns:

  • (ActiveSupport::SafeBuffer)

    breadcrumb HTML



35
36
37
38
39
40
41
42
# File 'app/presenters/www/support_article_presenter.rb', line 35

def breadcrumb(pl: nil)
  bcs = [{ name: 'Product Support', url: h.cms_link('/support') }]
  if (apl = pl || article.product_lines.first)
    bcs += h.catalog_breadcrumb_links(apl, section: :support)
  end
  bcs << { name: article.subject.to_s }
  h.formatted_breadcrumb bcs
end

#cache_keyString

Locale-scoped cache key for the article fragment.

Returns:

  • (String)

    cache key



9
10
11
# File 'app/presenters/www/support_article_presenter.rb', line 9

def cache_key
  "#{I18n.locale}/#{article.cache_key}"
end

#og_imagenil

Open Graph image for the article (currently unset).

Returns:

  • (nil)

    always nil



21
22
23
# File 'app/presenters/www/support_article_presenter.rb', line 21

def og_image
  # product_line&.primary_image&.image_url || DEFAULT_SOCIAL_ICON
end

#page_descriptionString

Meta description for the support article page.

Returns:

  • (String)

    page description



15
16
17
# File 'app/presenters/www/support_article_presenter.rb', line 15

def page_description
  "Support Article on #{article.description}"
end

#page_titleString

HTML title for the support article page.

Returns:

  • (String)

    page title with company locale suffix



27
28
29
# File 'app/presenters/www/support_article_presenter.rb', line 27

def page_title
  "#{article.page_title} | #{h.company_locale}"
end