From e08d2d3052e80ae617ba013b9305cc50289330a8 Mon Sep 17 00:00:00 2001 From: bootstraponline Date: Mon, 22 Oct 2012 19:10:40 -0600 Subject: [PATCH] Enable show_all for /pages --- lib/gollum/file.rb | 20 ++++++++++++++++++++ lib/gollum/file_view.rb | 2 +- lib/gollum/frontend/app.rb | 1 + 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/lib/gollum/file.rb b/lib/gollum/file.rb index f10e6bd0..856eae4d 100644 --- a/lib/gollum/file.rb +++ b/lib/gollum/file.rb @@ -13,6 +13,26 @@ module Gollum @path = nil end + # Public: The url path required to reach this page within the repo. + # + # Returns the String url_path + def url_path + path = if self.path.include?('/') + self.path.sub(/\/[^\/]+$/, '/') + else + '' + end + + path + end + + # Public: The url_path, but CGI escaped. + # + # Returns the String url_path + def escaped_url_path + CGI.escape(self.url_path).gsub('%2F','/') + end + # Public: The on-disk filename of the file. # # Returns the String name. diff --git a/lib/gollum/file_view.rb b/lib/gollum/file_view.rb index b869ddf4..7617c61b 100644 --- a/lib/gollum/file_view.rb +++ b/lib/gollum/file_view.rb @@ -7,7 +7,7 @@ module Gollum class FileView # common use cases: # set pages to wiki.pages and show_all to false - # set pages to wiki.files and show_all to true + # set pages to wiki.pages + wiki.files and show_all to true def initialize pages, show_all = false @pages = pages @show_all = show_all diff --git a/lib/gollum/frontend/app.rb b/lib/gollum/frontend/app.rb index b01b7daa..a44729e9 100644 --- a/lib/gollum/frontend/app.rb +++ b/lib/gollum/frontend/app.rb @@ -323,6 +323,7 @@ module Precious wiki_options = settings.wiki_options.merge({ :page_file_dir => @path }) wiki = Gollum::Wiki.new(settings.gollum_path, wiki_options) @results = wiki.pages + @results += wiki.files if settings.wiki_options[:show_all] @ref = wiki.ref mustache :pages end