Sha256: 0eac314027cf0996cd45ee77aaaabe957c7d54c36e88bc0e86c0231d0d16abda

Contents?: true

Size: 774 Bytes

Versions: 24

Compression:

Stored size: 774 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.public_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

24 entries across 24 versions & 1 rubygems

Version Path
tramway-core-1.9.3 app/helpers/tramway/core/title_helper.rb
tramway-core-1.9.2.1 app/helpers/tramway/core/title_helper.rb
tramway-core-1.9.2 app/helpers/tramway/core/title_helper.rb
tramway-core-1.9.1 app/helpers/tramway/core/title_helper.rb