Module: Tramway::Core::TitleHelper

Defined in:
app/helpers/tramway/core/title_helper.rb

Instance Method Summary collapse

Instance Method Details

#default_titleObject



13
14
15
# File 'app/helpers/tramway/core/title_helper.rb', line 13

def default_title
  t('.title')
end

#page_title(action, model_name) ⇒ Object



17
18
19
20
21
22
23
# File 'app/helpers/tramway/core/title_helper.rb', line 17

def page_title(action, model_name)
  if I18n.locale == :ru
    t("helpers.actions.#{action}") + ' ' + genitive(model_name)
  else
    t("helpers.actions.#{action}") + ' ' + model_name.model_name.human.downcase
  end
end

#title(page_title = default_title) ⇒ Object



4
5
6
7
8
9
10
11
# File 'app/helpers/tramway/core/title_helper.rb', line 4

def title(page_title = default_title)
  if @application.present?
    title_text = "#{page_title} | #{@application.try(:title) || @application.public_name}"
    content_for(:title) { title_text }
  else
    Tramway::Error.raise_error(:tramway, :core, :title_helper, :title, :you_should_set_tramway_core_application)
  end
end