Module: CurationConcerns::TitleHelper

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

Instance Method Summary collapse

Instance Method Details

#application_nameObject



2
3
4
# File 'app/helpers/curation_concerns/title_helper.rb', line 2

def application_name
  t('curation_concerns.product_name', default: super)
end

#construct_page_title(*elements) ⇒ Object



6
7
8
# File 'app/helpers/curation_concerns/title_helper.rb', line 6

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

#curation_concern_page_title(curation_concern) ⇒ Object



10
11
12
13
14
15
16
# File 'app/helpers/curation_concerns/title_helper.rb', line 10

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

#default_page_titleObject



18
19
20
21
22
# File 'app/helpers/curation_concerns/title_helper.rb', line 18

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