From 29a9204cf763ffd6fc055968b9752f8e7a0e1be7 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Wed, 5 May 2010 00:38:25 -0700 Subject: [PATCH] Fix the styling of the sidebar on the blueprint layout. --- doc-src/layouts/blueprint.haml | 4 +++- doc-src/lib/default.rb | 16 +++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/doc-src/layouts/blueprint.haml b/doc-src/layouts/blueprint.haml index ac0d38fb..b17f15a1 100644 --- a/doc-src/layouts/blueprint.haml +++ b/doc-src/layouts/blueprint.haml @@ -1,3 +1,5 @@ - render 'main' do - %aside(role="sidebar")= render 'partials/sidebar', :default_stylesheet => "_blueprint.scss", :omit_self => false, :heading_level => 2 + %aside(role="sidebar") + %nav#local-nav + %ul=item_tree(reference_item(:stylesheet => "_blueprint.scss"), :depth => 2, :omit_self => false, :heading_level => 2) %article= yield \ No newline at end of file diff --git a/doc-src/lib/default.rb b/doc-src/lib/default.rb index 4e9ec540..9aa26043 100644 --- a/doc-src/lib/default.rb +++ b/doc-src/lib/default.rb @@ -68,15 +68,13 @@ def item_tree(item, options = {}) options[:heading_level] ||= 1 if options.fetch(:headings, true) child_html = "" if options.fetch(:depth,1) > 0 - if item.children.any? - item.children.sort_by{|c| c[:crumb] || c[:title]}.each do |child| - child_opts = options.dup - child_opts[:depth] -= 1 if child_opts.has_key?(:depth) - child_opts[:heading_level] += 1 if child_opts[:heading_level] - child_opts.delete(:omit_self) - child_html << item_tree(child, child_opts) - end - end + child_opts = options.dup + child_opts[:depth] -= 1 if child_opts.has_key?(:depth) + child_opts[:heading_level] += 1 if child_opts[:heading_level] + child_opts.delete(:omit_self) + item.children.sort_by{|c| c[:crumb] || c[:title]}.each do |child| + child_html << item_tree(child, child_opts) + end else options.delete(:heading_level) end