From 00bcbbf72b70cf5435701c88c5f94d4ee324ec5a Mon Sep 17 00:00:00 2001 From: Adrian Knoth Date: Tue, 23 Oct 2012 14:25:43 +0200 Subject: [PATCH] File View: Add option to collapse file trees. For potentially large repositories, starting with a collapsed tree may be beneficial. --- lib/gollum/file_view.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/gollum/file_view.rb b/lib/gollum/file_view.rb index 7617c61b..c47eac96 100644 --- a/lib/gollum/file_view.rb +++ b/lib/gollum/file_view.rb @@ -8,9 +8,10 @@ module Gollum # common use cases: # set pages to wiki.pages and show_all to false # set pages to wiki.pages + wiki.files and show_all to true - def initialize pages, show_all = false + def initialize pages, options = {} @pages = pages - @show_all = show_all + @show_all = options[:show_all] || false + @checked = "checked" unless options[:collapse_tree] end def enclose_tree string @@ -30,7 +31,7 @@ module Gollum def new_sub_folder path <<-HTML
  • - +
      HTML end @@ -87,7 +88,7 @@ module Gollum url = url_for_page page html += <<-HTML
    1. - +
      1. #{name}