Merge pull request #422 from nature/sidebar_rendering_in_subfolders

Sidebar rendering in subfolders.
This commit is contained in:
bootstraponline
2012-07-09 09:19:11 -07:00
18 changed files with 60 additions and 12 deletions
+2 -3
View File
@@ -298,9 +298,8 @@ module Precious
def show_page_or_file(fullpath)
path = extract_path(fullpath)
name = extract_name(fullpath)
# This breaks headers, footers, and sidebars.
# wiki_options = settings.wiki_options.merge({ :page_file_dir => path })
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
wiki_options = settings.wiki_options.merge({ :page_file_dir => path })
wiki = Gollum::Wiki.new(settings.gollum_path, wiki_options)
if page = wiki.page(name)
@page = page
+4 -2
View File
@@ -434,7 +434,9 @@ module Gollum
end
# Loads a sub page. Sub page names (footers, headers, sidebars) are prefixed with
# an underscore to distinguish them from other Pages.
# an underscore to distinguish them from other Pages. If there is not one within
# the current directory, starts walking up the directory tree to try and find one
# within parent directories.
#
# name - String page name.
#
@@ -447,7 +449,7 @@ module Gollum
dirs = self.path.split('/')
dirs.pop
map = @wiki.tree_map_for(@wiki.ref)
map = @wiki.tree_map_for(@wiki.ref, true)
while !dirs.empty?
if page = find_page_in_tree(map, name, dirs.join('/'))
page.parent_page = self
+8 -2
View File
@@ -682,10 +682,16 @@ module Gollum
# listing is cached based on its actual commit SHA.
#
# ref - A String ref that is either a commit SHA or references one.
# ignore_page_file_dir - Boolean, if true, searches all files within the git repo, regardless of dir/subdir
#
# Returns an Array of BlobEntry instances.
def tree_map_for(ref)
@access.tree(ref)
def tree_map_for(ref, ignore_page_file_dir=false)
if ignore_page_file_dir && !@page_file_dir.nil?
@root_access ||= GitAccess.new(path, nil, @repo_is_bare)
@root_access.tree(ref)
else
@access.tree(ref)
end
rescue Grit::GitRuby::Repository::NoSuchShaFound
[]
end