Sha256: 20e3a3681275206d3dafcbc7afb8d8e052c31fc6213138d881f041e1d32d1a2d

Contents?: true

Size: 1.1 KB

Versions: 16

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

module Spotlight
  ##
  # Page title helpers
  module TitleHelper
    def curation_page_title(title = nil)
      page_title t(:'spotlight.curation.header'), title
    end

    def configuration_page_title(title = nil)
      page_title t(:'spotlight.configuration.header'), title
    end

    def page_title(section, title = nil)
      title ||= t(:'.header', default: '').presence

      head_content = t(:'spotlight.html_admin_title', section: section, title: title) if section && title
      head_content ||= section || title
      set_html_page_title(head_content)

      html_content = safe_join([
        (section if section.present?),
        (content_tag(:small, title) if title.present?)
      ].compact, "\n")

      content_tag(:h1, html_content, class: 'page-header')
    end

    # rubocop:disable Naming/AccessorMethodName
    def set_html_page_title(title = nil)
      @page_title = strip_tags(t(:'spotlight.html_title', title: title || t(:'.title', default: :'.header'), application_name: application_name)).html_safe
    end
    # rubocop:enable Naming/AccessorMethodName
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
blacklight-spotlight-3.3.0 app/helpers/spotlight/title_helper.rb
blacklight-spotlight-3.2.0 app/helpers/spotlight/title_helper.rb
blacklight-spotlight-3.1.0 app/helpers/spotlight/title_helper.rb
blacklight-spotlight-3.0.3 app/helpers/spotlight/title_helper.rb
blacklight-spotlight-3.0.2 app/helpers/spotlight/title_helper.rb
blacklight-spotlight-3.0.1 app/helpers/spotlight/title_helper.rb
blacklight-spotlight-3.0.0 app/helpers/spotlight/title_helper.rb
blacklight-spotlight-3.0.0.rc6 app/helpers/spotlight/title_helper.rb
blacklight-spotlight-3.0.0.rc5 app/helpers/spotlight/title_helper.rb
blacklight-spotlight-3.0.0.rc4 app/helpers/spotlight/title_helper.rb
blacklight-spotlight-3.0.0.rc3 app/helpers/spotlight/title_helper.rb
blacklight-spotlight-3.0.0.rc2 app/helpers/spotlight/title_helper.rb
blacklight-spotlight-3.0.0.rc1 app/helpers/spotlight/title_helper.rb
blacklight-spotlight-3.0.0.alpha.10 app/helpers/spotlight/title_helper.rb
blacklight-spotlight-3.0.0.alpha.9 app/helpers/spotlight/title_helper.rb
blacklight-spotlight-3.0.0.alpha.8 app/helpers/spotlight/title_helper.rb