summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorAlex Braha Stoll <alexbrahastoll@gmail.com>2016-12-27 01:44:03 -0200
committerAlex Braha Stoll <alexbrahastoll@gmail.com>2016-12-31 16:55:50 -0200
commit94dcadd62ac66cc5c52579ae9c288314bbca0c20 (patch)
tree2fe2ea2675ebaf2640a46f0fd8b6051af187514c /app/helpers
parent84cc7c3704cc0cc22a325572f35cd21d0e2a6cc7 (diff)
downloadgitlab-ce-94dcadd62ac66cc5c52579ae9c288314bbca0c20.tar.gz
Add a breadcrumb at projects/wikis/show.html.haml
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/wiki_helper.rb13
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