Module: Spotlight::TitleHelper

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

Instance Method Summary collapse

Instance Method Details

#administration_page_title(title = nil) ⇒ Object



7
8
9
# File 'app/helpers/spotlight/title_helper.rb', line 7

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

#curation_page_title(title = nil) ⇒ Object



3
4
5
# File 'app/helpers/spotlight/title_helper.rb', line 3

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

#header_with_count(*args) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'app/helpers/spotlight/title_helper.rb', line 20

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



11
12
13
14
# File 'app/helpers/spotlight/title_helper.rb', line 11

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



16
17
18
# File 'app/helpers/spotlight/title_helper.rb', line 16

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