Module: Spotlight::TitleHelper

Included in:
ApplicationHelper
Defined in:
app/helpers/spotlight/title_helper.rb

Overview

Page title helpers

Instance Method Summary collapse

Instance Method Details

#administration_page_title(title = nil) ⇒ Object



9
10
11
# File 'app/helpers/spotlight/title_helper.rb', line 9

def administration_page_title(title = nil)
  page_title t(:'spotlight.administration.header'), title
end

#curation_page_title(title = nil) ⇒ Object



5
6
7
# File 'app/helpers/spotlight/title_helper.rb', line 5

def curation_page_title(title = nil)
  page_title t(:'spotlight.curation.header'), title
end

#header_with_count(*args) ⇒ Object

rubocop:enable Style/AccessorMethodName



24
25
26
27
28
29
30
31
32
# File 'app/helpers/spotlight/title_helper.rb', line 24

def header_with_count(*args)
  title, count = if args.length == 2
                   args
                 else
                   [t(:'.header'), args.first]
                 end

  safe_join([title, (:span, count, class: 'label label-default')], ' ')
end

#page_title(section, title = nil) ⇒ Object



13
14
15
16
# File 'app/helpers/spotlight/title_helper.rb', line 13

def page_title(section, title = nil)
  set_html_page_title(t(:'spotlight.html_admin_title', section: section, title: title || t(:'.title', default: :'.header')))
  (:h1, safe_join([section, (:small, title || t(:'.header'))], "\n"), class: 'page-header')
end

#set_html_page_title(title = nil) ⇒ Object

rubocop:disable Style/AccessorMethodName



19
20
21
# File 'app/helpers/spotlight/title_helper.rb', line 19

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))
end