Module: Crm::LinkChecksHelper

Defined in:
app/helpers/crm/link_checks_helper.rb

Overview

View helpers for rendering link-check results in the CRM.

Instance Method Summary collapse

Instance Method Details

#link_check_article_links(link_check) ⇒ Array<String>

Builds one link (or a plain label when no path resolves) per article
attached to a link check.

Parameters:

  • link_check (LinkCheck)

    the link check whose articles are rendered

Returns:

  • (Array<String>)

    HTML-safe link or span tags, one per article



12
13
14
15
16
17
18
# File 'app/helpers/crm/link_checks_helper.rb', line 12

def link_check_article_links(link_check)
  link_check.articles.map do |article|
    path = polymorphic_article_path(article)
    label = "#{article.article_type_human}: #{article.subject}"
    path ? link_to(label, path) : (:span, label, class: 'text-body-secondary')
  end
end