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.6.1 app/helpers/tramway/core/title_helper.rb
tramway-core-1.18.6 app/helpers/tramway/core/title_helper.rb
tramway-core-1.18.5.2 app/helpers/tramway/core/title_helper.rb
tramway-core-1.18.5.1 app/helpers/tramway/core/title_helper.rb
tramway-core-1.18.5 app/helpers/tramway/core/title_helper.rb
tramway-core-1.18.4 app/helpers/tramway/core/title_helper.rb
tramway-core-1.18.3.5 app/helpers/tramway/core/title_helper.rb
tramway-core-1.18.3.4 app/helpers/tramway/core/title_helper.rb
tramway-core-1.18.3.3 app/helpers/tramway/core/title_helper.rb
tramway-core-1.18.3.2 app/helpers/tramway/core/title_helper.rb
tramway-core-1.18.3.1 app/helpers/tramway/core/title_helper.rb
tramway-core-1.18.3 app/helpers/tramway/core/title_helper.rb
tramway-core-1.18.2 app/helpers/tramway/core/title_helper.rb
tramway-core-1.18.1.2 app/helpers/tramway/core/title_helper.rb
tramway-core-1.18.1.1 app/helpers/tramway/core/title_helper.rb
tramway-core-1.18.1 app/helpers/tramway/core/title_helper.rb
tramway-core-1.18.0.4 app/helpers/tramway/core/title_helper.rb
tramway-core-1.18.0.3 app/helpers/tramway/core/title_helper.rb
tramway-core-1.18.0.2 app/helpers/tramway/core/title_helper.rb
tramway-core-1.18.0.1 app/helpers/tramway/core/title_helper.rb