Module: Spotlight::TitleHelper
- Included in:
- ApplicationHelper
- Defined in:
- app/helpers/spotlight/title_helper.rb
Overview
Page title helpers
Instance Method Summary collapse
- #accessibility_page_title(title = nil) ⇒ Object
- #configuration_page_title(title = nil) ⇒ Object
- #curation_page_title(title = nil) ⇒ Object
- #page_title(section, title = nil) ⇒ Object
- #set_html_page_title(title = nil) ⇒ Object
Instance Method Details
#accessibility_page_title(title = nil) ⇒ Object
11 12 13 |
# File 'app/helpers/spotlight/title_helper.rb', line 11 def accessibility_page_title(title = nil) page_title t(:'spotlight.accessibility.header'), title end |
#configuration_page_title(title = nil) ⇒ Object
15 16 17 |
# File 'app/helpers/spotlight/title_helper.rb', line 15 def configuration_page_title(title = nil) page_title t(:'spotlight.configuration.header'), title end |
#curation_page_title(title = nil) ⇒ Object
7 8 9 |
# File 'app/helpers/spotlight/title_helper.rb', line 7 def curation_page_title(title = nil) page_title t(:'spotlight.curation.header'), title end |
#page_title(section, title = nil) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/helpers/spotlight/title_helper.rb', line 19 def page_title(section, title = nil) title ||= t(:'.header', default: '').presence head_content = t(:'spotlight.html_admin_title', section:, title:) if section && title head_content ||= section || title set_html_page_title(head_content) html_content = safe_join([ section.presence, (content_tag(:small, title) if title.present?) ].compact, "\n") content_tag(:h1, html_content, class: 'page-header') end |
#set_html_page_title(title = nil) ⇒ Object
34 35 36 |
# File 'app/helpers/spotlight/title_helper.rb', line 34 def set_html_page_title(title = nil) @page_title = (t(:'spotlight.html_title', title: title || t(:'.title', default: :'.header'), application_name:)).html_safe end |