Module: Www::FaqHelper

Defined in:
app/helpers/www/faq_helper.rb

Instance Method Summary collapse

Instance Method Details

#faq_index_breadcrumb(product_line) ⇒ Object



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

def faq_index_breadcrumb(product_line)
  links = catalog_breadcrumb_links(product_line)
  if product_line.level > 0
    faq_url = catalog_link(product_line, section: :faqs)
    links << { name: "#{product_line.display_name} FAQs", url: faq_url } if faq_url
  end
  formatted_breadcrumb(links)
end

#faq_show_breadcrumb(item) ⇒ Object



11
12
13
14
15
# File 'app/helpers/www/faq_helper.rb', line 11

def faq_show_breadcrumb(item)
  links = item.primary_product_line ? catalog_breadcrumb_links(item.primary_product_line) : []
  links << { name: 'FAQs' }
  formatted_breadcrumb(links)
end

#retrieve_faqs(support: nil, sales: nil, tags: nil, add_vote_data: true, item: nil, product_line: nil) ⇒ Array<Article>

Convenience method to retrieve FAQs, sorted by popularity (votes) by default

Parameters:

  • support (Boolean, nil) (defaults to: nil)

    Filter by support portal flag

  • sales (Boolean, nil) (defaults to: nil)

    Filter by sales portal flag

  • tags (String, Array<String>, nil) (defaults to: nil)

    Tag(s) to filter by

  • add_vote_data (Boolean) (defaults to: true)

    Include vote data and sort by popularity (default: true)

  • item (Item, nil) (defaults to: nil)

    Filter FAQs for specific item

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

    Filter FAQs for specific product line

Returns:

  • (Array<Article>)

    FAQ articles, sorted by popularity when add_vote_data is true



26
27
28
29
30
31
32
33
# File 'app/helpers/www/faq_helper.rb', line 26

def retrieve_faqs(support: nil, sales: nil, tags: nil, add_vote_data: true, item: nil, product_line: nil)
  Item::ArticleRetriever.new(
    article_types: %w[faq],
    add_vote_data: add_vote_data,
    support: support,
    sales: sales
  ).process(product_line: product_line, item: item, tags: tags).articles
end