Sha256: 9dc5599775204900a68b867b100e15033b82b084ffe8cfda37008d2bca2f7b62

Contents?: true

Size: 688 Bytes

Versions: 39

Compression:

Stored size: 688 Bytes

Contents

# frozen_string_literal: true

module Tramway::Core::TitleHelper
  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

  def default_title
    t('.title')
  end

  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
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
tramway-core-1.18 app/helpers/tramway/core/title_helper.rb
tramway-core-1.17.9.1 app/helpers/tramway/core/title_helper.rb
tramway-core-1.17.9 app/helpers/tramway/core/title_helper.rb
tramway-core-1.17.8 app/helpers/tramway/core/title_helper.rb
tramway-core-1.17.7.2 app/helpers/tramway/core/title_helper.rb
tramway-core-1.17.7.1 app/helpers/tramway/core/title_helper.rb
tramway-core-1.17.7 app/helpers/tramway/core/title_helper.rb
tramway-core-1.17.6.1 app/helpers/tramway/core/title_helper.rb
tramway-core-1.17.6 app/helpers/tramway/core/title_helper.rb
tramway-core-1.17.5 app/helpers/tramway/core/title_helper.rb
tramway-core-1.17.4.2 app/helpers/tramway/core/title_helper.rb
tramway-core-1.17.4.1 app/helpers/tramway/core/title_helper.rb
tramway-core-1.17.4 app/helpers/tramway/core/title_helper.rb
tramway-core-1.17.3.1 app/helpers/tramway/core/title_helper.rb
tramway-core-1.17.3 app/helpers/tramway/core/title_helper.rb
tramway-core-1.17.2.5 app/helpers/tramway/core/title_helper.rb
tramway-core-1.17.2.4 app/helpers/tramway/core/title_helper.rb
tramway-core-1.17.2.3 app/helpers/tramway/core/title_helper.rb
tramway-core-1.17.2.2 app/helpers/tramway/core/title_helper.rb