Sha256: 2ffa02d96ca101b05461562b65ab0a0bf9e93bfbfecea3f53aa356b82a9473f7

Contents?: true

Size: 641 Bytes

Versions: 6

Compression:

Stored size: 641 Bytes

Contents

module Worthwhile::TitleHelper

  def construct_page_title(*elements)
    (elements.flatten.compact + [application_name]).join(" // ")
  end

  def curation_concern_page_title(curation_concern)
    if curation_concern.persisted?
      construct_page_title(curation_concern.title, "#{curation_concern.human_readable_type} [#{curation_concern.to_param}]")
    else
      construct_page_title("New #{curation_concern.human_readable_type}")
    end
  end

  def default_page_title
    text = controller_name.singularize.titleize
    if action_name
      text = "#{action_name.titleize} " + text
    end
    construct_page_title(text)
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
worthwhile-0.1.2 app/helpers/worthwhile/title_helper.rb
worthwhile-0.1.1 app/helpers/worthwhile/title_helper.rb
worthwhile-0.1.0 app/helpers/worthwhile/title_helper.rb
worthwhile-0.0.3 app/helpers/worthwhile/title_helper.rb
worthwhile-0.0.2 app/helpers/worthwhile/title_helper.rb
worthwhile-0.0.1 app/helpers/worthwhile/title_helper.rb