gitlab-org--gitlab-foss/app/helpers/wiki_helper.rb

14 lines
404 B
Ruby
Raw Normal View History

module WikiHelper
# Produces a pure text breadcrumb for a given page.
#
# page_slug - The slug of a WikiPage object.
#
# Returns a String composed of the capitalized name of each directory and the
# capitalized name of the page itself.
def breadcrumb(page_slug)
2017-06-21 13:48:12 +00:00
page_slug.split('/')
.map { |dir_or_page| WikiPage.unhyphenize(dir_or_page).capitalize }
.join(' / ')
end
end