diff options
author | Alex Braha Stoll <alexbrahastoll@gmail.com> | 2016-12-27 06:44:03 +0300 |
---|---|---|
committer | Alex Braha Stoll <alexbrahastoll@gmail.com> | 2016-12-31 21:55:50 +0300 |
commit | 94dcadd62ac66cc5c52579ae9c288314bbca0c20 (patch) | |
tree | 2fe2ea2675ebaf2640a46f0fd8b6051af187514c /app/helpers/wiki_helper.rb | |
parent | 84cc7c3704cc0cc22a325572f35cd21d0e2a6cc7 (diff) |
Add a breadcrumb at projects/wikis/show.html.haml
Diffstat (limited to 'app/helpers/wiki_helper.rb')
-rw-r--r-- | app/helpers/wiki_helper.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/helpers/wiki_helper.rb b/app/helpers/wiki_helper.rb new file mode 100644 index 00000000000..76ee632ab6d --- /dev/null +++ b/app/helpers/wiki_helper.rb @@ -0,0 +1,13 @@ +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) + page_slug.split('/'). + map { |dir_or_page| dir_or_page.gsub(/-+/, ' ').capitalize }. + join(' / ') + end +end |