Module: Hyrax::TitleHelper

Included in:
HyraxHelperBehavior
Defined in:
app/helpers/hyrax/title_helper.rb

Instance Method Summary collapse

Instance Method Details

#application_nameObject


4
5
6
# File 'app/helpers/hyrax/title_helper.rb', line 4

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

#construct_page_title(*elements) ⇒ Object


8
9
10
# File 'app/helpers/hyrax/title_helper.rb', line 8

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

#curation_concern_page_title(curation_concern) ⇒ Object

Deprecated.

14
15
16
17
18
# File 'app/helpers/hyrax/title_helper.rb', line 14

def curation_concern_page_title(curation_concern)
  Deprecation.warn 'The curation_concern_page_title helper will be removed in Hyrax 4.0.' \
                   "\n\tUse title_presenter(curation_concern).page_title instead."
  title_presenter(curation_concern).page_title
end

#default_page_titleObject


20
21
22
23
24
# File 'app/helpers/hyrax/title_helper.rb', line 20

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

#title_presenter(resource) ⇒ Object


26
27
28
# File 'app/helpers/hyrax/title_helper.rb', line 26

def title_presenter(resource)
  Hyrax::PageTitleDecorator.new(resource)
end