From 2040be4b6c8749dbd092eb6638a15f24a515b113 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sat, 18 Dec 2010 16:25:49 -0800 Subject: [PATCH] Smarter sidebar logic --- doc-src/Gemfile.lock | 2 +- doc-src/content/reference/blueprint/reset.haml | 1 + doc-src/content/reference/compass/css3.haml | 1 + doc-src/content/reference/compass/helpers.haml | 1 + doc-src/content/reference/compass/layout.haml | 1 + doc-src/content/reference/compass/reset.haml | 1 + .../content/reference/compass/utilities.haml | 1 + .../reference/compass/utilities/general.haml | 2 +- .../compass/utilities/general/clearfix.haml | 1 - .../compass/utilities/general/float.haml | 1 - .../compass/utilities/general/hacks.haml | 1 - .../compass/utilities/general/min.haml | 1 - .../compass/utilities/general/reset.haml | 1 - .../compass/utilities/general/tag_cloud.haml | 1 - .../reference/compass/utilities/links.haml | 2 +- .../compass/utilities/links/hover_link.haml | 1 - .../compass/utilities/links/link_colors.haml | 1 - .../compass/utilities/links/unstyled_link.haml | 1 - .../reference/compass/utilities/lists.haml | 2 +- .../compass/utilities/lists/bullets.haml | 1 - .../utilities/lists/horizontal_list.haml | 1 - .../utilities/lists/inline-block-list.haml | 1 - .../compass/utilities/lists/inline_list.haml | 1 - .../reference/compass/utilities/print.haml | 1 - .../reference/compass/utilities/sprites.haml | 2 +- .../compass/utilities/sprites/base.haml | 1 - .../compass/utilities/sprites/sprite_img.haml | 1 - .../reference/compass/utilities/tables.haml | 2 +- .../tables/alternating_rows_and_columns.haml | 1 - .../compass/utilities/tables/borders.haml | 1 - .../compass/utilities/tables/scaffolding.haml | 1 - .../reference/compass/utilities/text.haml | 2 +- .../compass/utilities/text/ellipsis.haml | 1 - .../compass/utilities/text/nowrap.haml | 1 - .../compass/utilities/text/replacement.haml | 1 - .../content/stylesheets/partials/_sidebar.scss | 6 ++++++ doc-src/layouts/blueprint.haml | 2 +- doc-src/layouts/core.haml | 2 +- doc-src/layouts/partials/sidebar.haml | 5 ++++- doc-src/lib/default.rb | 18 +++++++++++++++++- 40 files changed, 42 insertions(+), 33 deletions(-) diff --git a/doc-src/Gemfile.lock b/doc-src/Gemfile.lock index be1d5a32..a1f8d986 100644 --- a/doc-src/Gemfile.lock +++ b/doc-src/Gemfile.lock @@ -14,7 +14,7 @@ GIT PATH remote: .. specs: - compass (0.11.alpha.4.992eb8d) + compass (0.11.alpha.4.ff6c3a0) chunky_png (~> 0.10.3) sass (>= 3.1.0.alpha.50) diff --git a/doc-src/content/reference/blueprint/reset.haml b/doc-src/content/reference/blueprint/reset.haml index ab605898..d38856f9 100644 --- a/doc-src/content/reference/blueprint/reset.haml +++ b/doc-src/content/reference/blueprint/reset.haml @@ -3,6 +3,7 @@ title: Blueprint Reset crumb: Reset framework: blueprint stylesheet: blueprint/_reset.scss +sidebar: true layout: blueprint classnames: - reference diff --git a/doc-src/content/reference/compass/css3.haml b/doc-src/content/reference/compass/css3.haml index 4915526c..d002979d 100644 --- a/doc-src/content/reference/compass/css3.haml +++ b/doc-src/content/reference/compass/css3.haml @@ -3,6 +3,7 @@ title: Compass CSS3 crumb: CSS3 framework: compass stylesheet: compass/_css3.scss +sidebar: true layout: core classnames: - reference diff --git a/doc-src/content/reference/compass/helpers.haml b/doc-src/content/reference/compass/helpers.haml index 27730dd5..4903d283 100644 --- a/doc-src/content/reference/compass/helpers.haml +++ b/doc-src/content/reference/compass/helpers.haml @@ -2,6 +2,7 @@ title: Compass Helpers crumb: Helpers framework: compass +sidebar: true layout: core classnames: - reference diff --git a/doc-src/content/reference/compass/layout.haml b/doc-src/content/reference/compass/layout.haml index 3d87ffcd..50694755 100644 --- a/doc-src/content/reference/compass/layout.haml +++ b/doc-src/content/reference/compass/layout.haml @@ -2,6 +2,7 @@ title: Compass Layout crumb: Layout framework: compass +sidebar: true stylesheet: compass/_layout.scss meta_description: Page layout module. So far, this is just the sticky-footer mixin. layout: core diff --git a/doc-src/content/reference/compass/reset.haml b/doc-src/content/reference/compass/reset.haml index 593bf669..5001a7d1 100644 --- a/doc-src/content/reference/compass/reset.haml +++ b/doc-src/content/reference/compass/reset.haml @@ -4,6 +4,7 @@ crumb: Reset framework: compass stylesheet: compass/_reset.scss layout: core +sidebar: true classnames: - reference - core diff --git a/doc-src/content/reference/compass/utilities.haml b/doc-src/content/reference/compass/utilities.haml index 7336931e..2a6165c4 100644 --- a/doc-src/content/reference/compass/utilities.haml +++ b/doc-src/content/reference/compass/utilities.haml @@ -2,6 +2,7 @@ title: Compass Utilities crumb: Utilities framework: compass +sidebar: true stylesheet: compass/_utilities.scss classnames: - reference diff --git a/doc-src/content/reference/compass/utilities/general.haml b/doc-src/content/reference/compass/utilities/general.haml index 7ea74cbc..8a3148a5 100644 --- a/doc-src/content/reference/compass/utilities/general.haml +++ b/doc-src/content/reference/compass/utilities/general.haml @@ -3,8 +3,8 @@ title: Compass General Utilities crumb: General framework: compass stylesheet: compass/utilities/_general.scss +sidebar: true layout: core -nav_stylesheet: compass/_utilities.scss meta_description: Generally useful utilities that don't fit elsewhere. classnames: - reference diff --git a/doc-src/content/reference/compass/utilities/general/clearfix.haml b/doc-src/content/reference/compass/utilities/general/clearfix.haml index c95f74fa..822522eb 100644 --- a/doc-src/content/reference/compass/utilities/general/clearfix.haml +++ b/doc-src/content/reference/compass/utilities/general/clearfix.haml @@ -4,7 +4,6 @@ crumb: Clearfix framework: compass stylesheet: compass/utilities/general/_clearfix.scss layout: core -nav_stylesheet: compass/_utilities.scss meta_description: Mixins for clearfixing. classnames: - reference diff --git a/doc-src/content/reference/compass/utilities/general/float.haml b/doc-src/content/reference/compass/utilities/general/float.haml index 31ed4769..04291609 100644 --- a/doc-src/content/reference/compass/utilities/general/float.haml +++ b/doc-src/content/reference/compass/utilities/general/float.haml @@ -4,7 +4,6 @@ crumb: Float framework: compass stylesheet: compass/utilities/general/_float.scss layout: core -nav_stylesheet: compass/_utilities.scss meta_description: Mixins for cross-browser floats. classnames: - reference diff --git a/doc-src/content/reference/compass/utilities/general/hacks.haml b/doc-src/content/reference/compass/utilities/general/hacks.haml index 68474809..e6103a03 100644 --- a/doc-src/content/reference/compass/utilities/general/hacks.haml +++ b/doc-src/content/reference/compass/utilities/general/hacks.haml @@ -4,7 +4,6 @@ crumb: Hacks framework: compass stylesheet: compass/utilities/general/_hacks.scss layout: core -nav_stylesheet: compass/_utilities.scss meta_description: Mixins for hacking specific browsers. classnames: - reference diff --git a/doc-src/content/reference/compass/utilities/general/min.haml b/doc-src/content/reference/compass/utilities/general/min.haml index 38ed3dfd..532eb231 100644 --- a/doc-src/content/reference/compass/utilities/general/min.haml +++ b/doc-src/content/reference/compass/utilities/general/min.haml @@ -5,7 +5,6 @@ framework: compass stylesheet: compass/utilities/general/_min.scss layout: core meta_description: Mixins for cross-browser min-height and min-width. -nav_stylesheet: compass/_utilities.scss classnames: - reference - core diff --git a/doc-src/content/reference/compass/utilities/general/reset.haml b/doc-src/content/reference/compass/utilities/general/reset.haml index 87f224de..267f98f4 100644 --- a/doc-src/content/reference/compass/utilities/general/reset.haml +++ b/doc-src/content/reference/compass/utilities/general/reset.haml @@ -5,7 +5,6 @@ framework: compass stylesheet: compass/utilities/general/_reset.scss layout: core meta_description: Mixins for resetting elements (old import). -nav_stylesheet: compass/_utilities.scss classnames: - reference - core diff --git a/doc-src/content/reference/compass/utilities/general/tag_cloud.haml b/doc-src/content/reference/compass/utilities/general/tag_cloud.haml index 362da72c..c3b0f353 100644 --- a/doc-src/content/reference/compass/utilities/general/tag_cloud.haml +++ b/doc-src/content/reference/compass/utilities/general/tag_cloud.haml @@ -5,7 +5,6 @@ framework: compass stylesheet: compass/utilities/general/_tag-cloud.scss layout: core meta_description: Mixin for styling tag clouds. -nav_stylesheet: compass/_utilities.scss classnames: - reference - core diff --git a/doc-src/content/reference/compass/utilities/links.haml b/doc-src/content/reference/compass/utilities/links.haml index 0c6aacc6..f313b231 100644 --- a/doc-src/content/reference/compass/utilities/links.haml +++ b/doc-src/content/reference/compass/utilities/links.haml @@ -3,8 +3,8 @@ title: Compass Links crumb: Links framework: compass stylesheet: compass/utilities/_links.scss +sidebar: true layout: core -nav_stylesheet: compass/_utilities.scss meta_description: Tools for styling anchor links. classnames: - reference diff --git a/doc-src/content/reference/compass/utilities/links/hover_link.haml b/doc-src/content/reference/compass/utilities/links/hover_link.haml index bb8cbeef..74b73599 100644 --- a/doc-src/content/reference/compass/utilities/links/hover_link.haml +++ b/doc-src/content/reference/compass/utilities/links/hover_link.haml @@ -5,7 +5,6 @@ framework: compass stylesheet: compass/utilities/links/_hover-link.scss layout: core meta_description: Underline a link when you hover over it. -nav_stylesheet: compass/_utilities.scss classnames: - reference - core diff --git a/doc-src/content/reference/compass/utilities/links/link_colors.haml b/doc-src/content/reference/compass/utilities/links/link_colors.haml index e7742277..e8f90281 100644 --- a/doc-src/content/reference/compass/utilities/links/link_colors.haml +++ b/doc-src/content/reference/compass/utilities/links/link_colors.haml @@ -5,7 +5,6 @@ framework: compass stylesheet: compass/utilities/links/_link-colors.scss layout: core meta_description: Easy assignment of colors to link states. -nav_stylesheet: compass/_utilities.scss classnames: - reference - core diff --git a/doc-src/content/reference/compass/utilities/links/unstyled_link.haml b/doc-src/content/reference/compass/utilities/links/unstyled_link.haml index d23e4d93..54a4bcd9 100644 --- a/doc-src/content/reference/compass/utilities/links/unstyled_link.haml +++ b/doc-src/content/reference/compass/utilities/links/unstyled_link.haml @@ -5,7 +5,6 @@ framework: compass stylesheet: compass/utilities/links/_unstyled-link.scss layout: core meta_description: Make a link appear like regular text. -nav_stylesheet: compass/_utilities.scss classnames: - reference - core diff --git a/doc-src/content/reference/compass/utilities/lists.haml b/doc-src/content/reference/compass/utilities/lists.haml index 8f7190f4..fbe1c735 100644 --- a/doc-src/content/reference/compass/utilities/lists.haml +++ b/doc-src/content/reference/compass/utilities/lists.haml @@ -3,8 +3,8 @@ title: Compass Lists crumb: Lists framework: compass stylesheet: compass/utilities/_lists.scss +sidebar: true layout: core -nav_stylesheet: compass/_utilities.scss meta_description: Tools for styling lists. classnames: - reference diff --git a/doc-src/content/reference/compass/utilities/lists/bullets.haml b/doc-src/content/reference/compass/utilities/lists/bullets.haml index 94da0c93..3f9c19fb 100644 --- a/doc-src/content/reference/compass/utilities/lists/bullets.haml +++ b/doc-src/content/reference/compass/utilities/lists/bullets.haml @@ -5,7 +5,6 @@ framework: compass stylesheet: compass/utilities/lists/_bullets.scss layout: core meta_description: Mixins for managing list bullets. -nav_stylesheet: compass/_utilities.scss classnames: - reference - core diff --git a/doc-src/content/reference/compass/utilities/lists/horizontal_list.haml b/doc-src/content/reference/compass/utilities/lists/horizontal_list.haml index 56a4cd86..68735199 100644 --- a/doc-src/content/reference/compass/utilities/lists/horizontal_list.haml +++ b/doc-src/content/reference/compass/utilities/lists/horizontal_list.haml @@ -5,7 +5,6 @@ framework: compass stylesheet: compass/utilities/lists/_horizontal-list.scss layout: core meta_description: Float a list so it appears horizontally. -nav_stylesheet: compass/_utilities.scss classnames: - reference - core diff --git a/doc-src/content/reference/compass/utilities/lists/inline-block-list.haml b/doc-src/content/reference/compass/utilities/lists/inline-block-list.haml index c315e30b..2ce51b92 100644 --- a/doc-src/content/reference/compass/utilities/lists/inline-block-list.haml +++ b/doc-src/content/reference/compass/utilities/lists/inline-block-list.haml @@ -5,7 +5,6 @@ framework: compass stylesheet: compass/utilities/lists/_inline-block-list.scss layout: core meta_description: set list-elements to inline-block so they appear horizontally while retaining their structure. -nav_stylesheet: compass/_utilities.scss classnames: - reference - core diff --git a/doc-src/content/reference/compass/utilities/lists/inline_list.haml b/doc-src/content/reference/compass/utilities/lists/inline_list.haml index 17545c86..c63e5951 100644 --- a/doc-src/content/reference/compass/utilities/lists/inline_list.haml +++ b/doc-src/content/reference/compass/utilities/lists/inline_list.haml @@ -5,7 +5,6 @@ framework: compass stylesheet: compass/utilities/lists/_inline-list.scss layout: core meta_description: Style a list as inline text. -nav_stylesheet: compass/_utilities.scss classnames: - reference - core diff --git a/doc-src/content/reference/compass/utilities/print.haml b/doc-src/content/reference/compass/utilities/print.haml index 13afd20e..490b66e2 100644 --- a/doc-src/content/reference/compass/utilities/print.haml +++ b/doc-src/content/reference/compass/utilities/print.haml @@ -5,7 +5,6 @@ framework: compass stylesheet: compass/utilities/_print.scss layout: core meta_description: Control what elements gets printed. -nav_stylesheet: compass/_utilities.scss classnames: - reference - core diff --git a/doc-src/content/reference/compass/utilities/sprites.haml b/doc-src/content/reference/compass/utilities/sprites.haml index c50cef9c..5b1bd949 100644 --- a/doc-src/content/reference/compass/utilities/sprites.haml +++ b/doc-src/content/reference/compass/utilities/sprites.haml @@ -3,9 +3,9 @@ title: Compass Sprites crumb: Sprites framework: compass stylesheet: compass/utilities/_sprites.scss +sidebar: true layout: core meta_description: Sprite mixins. -nav_stylesheet: compass/_utilities.scss classnames: - reference - core diff --git a/doc-src/content/reference/compass/utilities/sprites/base.haml b/doc-src/content/reference/compass/utilities/sprites/base.haml index 5fec97e9..cc3e23e5 100644 --- a/doc-src/content/reference/compass/utilities/sprites/base.haml +++ b/doc-src/content/reference/compass/utilities/sprites/base.haml @@ -4,7 +4,6 @@ crumb: Sprite Base framework: compass stylesheet: compass/utilities/sprites/_base.scss layout: core -nav_stylesheet: compass/_utilities.scss classnames: - reference - core diff --git a/doc-src/content/reference/compass/utilities/sprites/sprite_img.haml b/doc-src/content/reference/compass/utilities/sprites/sprite_img.haml index af7ba3cb..8f51a96f 100644 --- a/doc-src/content/reference/compass/utilities/sprites/sprite_img.haml +++ b/doc-src/content/reference/compass/utilities/sprites/sprite_img.haml @@ -4,7 +4,6 @@ crumb: Sprite Image framework: compass stylesheet: compass/utilities/sprites/_sprite-img.scss layout: core -nav_stylesheet: compass/_utilities.scss classnames: - reference - core diff --git a/doc-src/content/reference/compass/utilities/tables.haml b/doc-src/content/reference/compass/utilities/tables.haml index 0832d667..abd45c30 100644 --- a/doc-src/content/reference/compass/utilities/tables.haml +++ b/doc-src/content/reference/compass/utilities/tables.haml @@ -4,8 +4,8 @@ crumb: Tables framework: compass stylesheet: compass/utilities/_tables.scss layout: core +sidebar: true meta_description: Style helpers for your tables. -nav_stylesheet: compass/_utilities.scss classnames: - reference - core diff --git a/doc-src/content/reference/compass/utilities/tables/alternating_rows_and_columns.haml b/doc-src/content/reference/compass/utilities/tables/alternating_rows_and_columns.haml index a6012b03..15dd2cf3 100644 --- a/doc-src/content/reference/compass/utilities/tables/alternating_rows_and_columns.haml +++ b/doc-src/content/reference/compass/utilities/tables/alternating_rows_and_columns.haml @@ -4,7 +4,6 @@ crumb: Table Striping framework: compass stylesheet: compass/utilities/tables/_alternating-rows-and-columns.scss layout: core -nav_stylesheet: compass/_utilities.scss meta_description: Add striping to a table. classnames: - reference diff --git a/doc-src/content/reference/compass/utilities/tables/borders.haml b/doc-src/content/reference/compass/utilities/tables/borders.haml index f8784e45..c604b8aa 100644 --- a/doc-src/content/reference/compass/utilities/tables/borders.haml +++ b/doc-src/content/reference/compass/utilities/tables/borders.haml @@ -4,7 +4,6 @@ crumb: Table Borders framework: compass stylesheet: compass/utilities/tables/_borders.scss layout: core -nav_stylesheet: compass/_utilities.scss meta_description: Add borders to a table. classnames: - reference diff --git a/doc-src/content/reference/compass/utilities/tables/scaffolding.haml b/doc-src/content/reference/compass/utilities/tables/scaffolding.haml index 4501b8b5..64196c92 100644 --- a/doc-src/content/reference/compass/utilities/tables/scaffolding.haml +++ b/doc-src/content/reference/compass/utilities/tables/scaffolding.haml @@ -4,7 +4,6 @@ crumb: Table Scaffolding framework: compass stylesheet: compass/utilities/tables/_scaffolding.scss layout: core -nav_stylesheet: compass/_utilities.scss meta_description: Basic styling of tables to get you started. classnames: - reference diff --git a/doc-src/content/reference/compass/utilities/text.haml b/doc-src/content/reference/compass/utilities/text.haml index 70c7f01c..2c8e918d 100644 --- a/doc-src/content/reference/compass/utilities/text.haml +++ b/doc-src/content/reference/compass/utilities/text.haml @@ -4,8 +4,8 @@ crumb: Text framework: compass stylesheet: compass/utilities/_text.scss layout: core +sidebar: true meta_description: Style helpers for your text. -nav_stylesheet: compass/_utilities.scss classnames: - reference - core diff --git a/doc-src/content/reference/compass/utilities/text/ellipsis.haml b/doc-src/content/reference/compass/utilities/text/ellipsis.haml index 5d6f1d15..3ce24d74 100644 --- a/doc-src/content/reference/compass/utilities/text/ellipsis.haml +++ b/doc-src/content/reference/compass/utilities/text/ellipsis.haml @@ -4,7 +4,6 @@ crumb: Ellipsis framework: compass stylesheet: compass/utilities/text/_ellipsis.scss layout: core -nav_stylesheet: compass/_utilities.scss meta_description: Text truncation with ellipsis. classnames: - reference diff --git a/doc-src/content/reference/compass/utilities/text/nowrap.haml b/doc-src/content/reference/compass/utilities/text/nowrap.haml index 3bd97b19..ed7be511 100644 --- a/doc-src/content/reference/compass/utilities/text/nowrap.haml +++ b/doc-src/content/reference/compass/utilities/text/nowrap.haml @@ -5,7 +5,6 @@ framework: compass stylesheet: compass/utilities/text/_nowrap.scss layout: core meta_description: Remembering whether or not there's a hyphen in white-space is too hard. -nav_stylesheet: compass/_utilities.scss classnames: - reference - core diff --git a/doc-src/content/reference/compass/utilities/text/replacement.haml b/doc-src/content/reference/compass/utilities/text/replacement.haml index 676874b4..239e0986 100644 --- a/doc-src/content/reference/compass/utilities/text/replacement.haml +++ b/doc-src/content/reference/compass/utilities/text/replacement.haml @@ -5,7 +5,6 @@ framework: compass stylesheet: compass/utilities/text/_replacement.scss layout: core meta_description: Replace text with images. -nav_stylesheet: compass/_utilities.scss classnames: - reference - core diff --git a/doc-src/content/stylesheets/partials/_sidebar.scss b/doc-src/content/stylesheets/partials/_sidebar.scss index 72caf244..9894ed92 100644 --- a/doc-src/content/stylesheets/partials/_sidebar.scss +++ b/doc-src/content/stylesheets/partials/_sidebar.scss @@ -16,6 +16,12 @@ aside { a { font-size: .85em; } + ul ul a { + &.selected, &.selected:hover { + font-weight: bold; + text-decoration: underline; + } + } .deprecated { text-decoration: line-through; } diff --git a/doc-src/layouts/blueprint.haml b/doc-src/layouts/blueprint.haml index 9794fa5d..49aed49c 100644 --- a/doc-src/layouts/blueprint.haml +++ b/doc-src/layouts/blueprint.haml @@ -1,4 +1,4 @@ - render 'main' do - %aside(role="sidebar")= render 'partials/sidebar', :default_stylesheet => "_blueprint.scss" + %aside(role="sidebar")= render 'partials/sidebar', :default_stylesheet => "_blueprint.scss", :omit_self => false, :heading_level => 2, :heading_depth => 1 %article= yield \ No newline at end of file diff --git a/doc-src/layouts/core.haml b/doc-src/layouts/core.haml index b146930d..0843c512 100644 --- a/doc-src/layouts/core.haml +++ b/doc-src/layouts/core.haml @@ -1,5 +1,5 @@ - render 'main' do - content_for :module_nav do %ul= item_tree(reference_item(:stylesheet => "compass.scss"), :depth => 1, :omit_self => true, :headings => false) - %aside(role="sidebar")= render 'partials/sidebar', :default_stylesheet => "_compass.scss" + %aside(role="sidebar")= render 'partials/sidebar', :default_stylesheet => "_compass.scss", :omit_self => false, :heading_level => 2, :heading_depth => 1 %article= yield \ No newline at end of file diff --git a/doc-src/layouts/partials/sidebar.haml b/doc-src/layouts/partials/sidebar.haml index 456f9fb2..9a836d62 100644 --- a/doc-src/layouts/partials/sidebar.haml +++ b/doc-src/layouts/partials/sidebar.haml @@ -1,2 +1,5 @@ %nav#local-nav - = item_tree(reference_item(:stylesheet => (@item[:nav_stylesheet] || @default_stylesheet)), :depth => 2, :omit_self => get_var(:omit_self){true}, :heading_level => get_var(:heading_level){1}) + - sidebar_item = reference_item(:stylesheet => @item[:nav_stylesheet]) if @item[:nav_stylesheet] + - sidebar_item ||= sidebar_item(@item) + - sidebar_item ||= reference_item(:stylesheet => @default_stylesheet) + %ul= item_tree(sidebar_item, :depth => 1, :omit_self => get_var(:omit_self){true}, :heading_level => get_var(:heading_level){1}, :heading_depth => get_var(:heading_depth){10}) diff --git a/doc-src/lib/default.rb b/doc-src/lib/default.rb index df863c53..39b25dec 100644 --- a/doc-src/lib/default.rb +++ b/doc-src/lib/default.rb @@ -61,6 +61,21 @@ end def get_var(instance_var) instance_variable_defined?("@#{instance_var}") ? instance_variable_get("@#{instance_var}") : yield end + +def sidebar_item(item) + if item.nil? + nil + elsif item[:sidebar] + item + else + sidebar_item(item.parent) + end +end + +def sidebar_stylesheet(item) + i = sidebar_item(item) + i[:stylesheet] if i +end def item_tree(item, options = {}) @@ -70,6 +85,7 @@ def item_tree(item, options = {}) if options.fetch(:depth,1) > 0 child_opts = options.dup child_opts[:depth] -= 1 if child_opts.has_key?(:depth) + child_opts[:heading_depth] -= 1 if child_opts.has_key?(:heading_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| @@ -87,7 +103,7 @@ def item_tree(item, options = {}) :selected => !!@item.identifier[item.identifier], :crumb => item[:crumb] || item[:title] } - if options[:heading_level] + if options[:heading_level] && (options.fetch(:heading_depth, 1) > 0) render("partials/sidebar/heading", item_opts.merge(:heading => "h#{options[:heading_level]}") )