Sha256: c72fba07f71b57fe5abdff53506420dde684827baf5ba12964321bab767bc82f

Contents?: true

Size: 767 Bytes

Versions: 2

Compression:

Stored size: 767 Bytes

Contents

module Tramway
  module Core
    module TitleHelper
      def title(page_title = default_title)
        if @application.present?
          title_text = "#{page_title} | #{@application.try(:title) || @application.name}" 
          content_for(:title) { title_text }
        else
          error = Tramway::Error.new(plugin: :core, method: :title, message: ('You should set Tramway::Core::Application class using `::Tramway::Core.initialize_application model_class: #{model_class_name}` in config/initializers/tramway.rb'))
          raise error.message
        end
      end

      def default_title
        t('.title')
      end

      def page_title(action, model_name)
        t("helpers.actions.#{action}") + ' ' + genitive(model_name)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tramway-core-1.9 app/helpers/tramway/core/title_helper.rb
tramway-core-1.8.4 app/helpers/tramway/core/title_helper.rb