Add --collapse-tree command line option

This commit is contained in:
Adrian Knoth
2012-10-23 14:26:17 +02:00
parent 00bcbbf72b
commit c7a9534ed9
3 changed files with 7 additions and 1 deletions
+4
View File
@@ -72,6 +72,10 @@ opts = OptionParser.new do |opts|
opts.on("--show-all", "Shows all files in file view. By default only valid pages are shown.") do
wiki_options[:show_all] = true
end
opts.on("--collapse-tree", "Collapse file view tree. By default, expanded tree is shown.") do
wiki_options[:collapse_tree] = true
end
end
# Read command line options into `options` hash
+1 -1
View File
@@ -332,7 +332,7 @@ module Precious
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
show_all = settings.wiki_options[:show_all]
# if showing all files include wiki.files
@results = show_all ? Gollum::FileView.new(wiki.pages + wiki.files, show_all).render_files :
@results = show_all ? Gollum::FileView.new(wiki.pages + wiki.files, settings.wiki_options).render_files :
Gollum::FileView.new(wiki.pages).render_files
@ref = wiki.ref
mustache :file_view, { :layout => false }
+2
View File
@@ -156,6 +156,7 @@ module Gollum
# :mathjax - Set to false to disable mathjax.
# :show_all - Show all files in file view, not just valid pages.
# Default: false
# :collapse_tree - Start with collapsed file view. Default: false
#
# Returns a fresh Gollum::Repo.
def initialize(path, options = {})
@@ -183,6 +184,7 @@ module Gollum
@universal_toc = options.fetch(:universal_toc, false)
@mathjax = options[:mathjax] || false
@show_all = options[:show_all] || false
@collapse_tree = options[:collapse_tree] || false
end
# Public: check whether the wiki's git repo exists on the filesystem.