Module: Worthwhile::TitleHelper

Included in:
MainAppHelpers
Defined in:
app/helpers/worthwhile/title_helper.rb

Instance Method Summary collapse

Instance Method Details

#construct_page_title(*elements) ⇒ Object



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

def construct_page_title(*elements)
  (elements.flatten.compact + [application_name]).join(" // ")
end

#curation_concern_page_title(curation_concern) ⇒ Object



7
8
9
10
11
12
13
# File 'app/helpers/worthwhile/title_helper.rb', line 7

def curation_concern_page_title(curation_concern)
  if curation_concern.persisted?
    construct_page_title(curation_concern.title, "#{curation_concern.human_readable_type} [#{curation_concern.to_param}]")
  else
    construct_page_title("New #{curation_concern.human_readable_type}")
  end
end

#default_page_titleObject



15
16
17
18
19
20
21
# File 'app/helpers/worthwhile/title_helper.rb', line 15

def default_page_title
  text = controller_name.singularize.titleize
  if action_name
    text = "#{action_name.titleize} " + text
  end
  construct_page_title(text)
end