From c7a9534ed990a1f7df268dd7f6338cbc8dfef669 Mon Sep 17 00:00:00 2001 From: Adrian Knoth Date: Tue, 23 Oct 2012 14:26:17 +0200 Subject: [PATCH] Add --collapse-tree command line option --- bin/gollum | 4 ++++ lib/gollum/frontend/app.rb | 2 +- lib/gollum/wiki.rb | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/gollum b/bin/gollum index 924144a1..3f98a988 100755 --- a/bin/gollum +++ b/bin/gollum @@ -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 diff --git a/lib/gollum/frontend/app.rb b/lib/gollum/frontend/app.rb index a44729e9..b6e33d72 100644 --- a/lib/gollum/frontend/app.rb +++ b/lib/gollum/frontend/app.rb @@ -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 } diff --git a/lib/gollum/wiki.rb b/lib/gollum/wiki.rb index 80dee7ab..26bef0ba 100644 --- a/lib/gollum/wiki.rb +++ b/lib/gollum/wiki.rb @@ -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.