Smarter sidebar logic
This commit is contained in:
parent
ff6c3a078a
commit
2040be4b6c
@ -14,7 +14,7 @@ GIT
|
|||||||
PATH
|
PATH
|
||||||
remote: ..
|
remote: ..
|
||||||
specs:
|
specs:
|
||||||
compass (0.11.alpha.4.992eb8d)
|
compass (0.11.alpha.4.ff6c3a0)
|
||||||
chunky_png (~> 0.10.3)
|
chunky_png (~> 0.10.3)
|
||||||
sass (>= 3.1.0.alpha.50)
|
sass (>= 3.1.0.alpha.50)
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ title: Blueprint Reset
|
|||||||
crumb: Reset
|
crumb: Reset
|
||||||
framework: blueprint
|
framework: blueprint
|
||||||
stylesheet: blueprint/_reset.scss
|
stylesheet: blueprint/_reset.scss
|
||||||
|
sidebar: true
|
||||||
layout: blueprint
|
layout: blueprint
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
|
@ -3,6 +3,7 @@ title: Compass CSS3
|
|||||||
crumb: CSS3
|
crumb: CSS3
|
||||||
framework: compass
|
framework: compass
|
||||||
stylesheet: compass/_css3.scss
|
stylesheet: compass/_css3.scss
|
||||||
|
sidebar: true
|
||||||
layout: core
|
layout: core
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
title: Compass Helpers
|
title: Compass Helpers
|
||||||
crumb: Helpers
|
crumb: Helpers
|
||||||
framework: compass
|
framework: compass
|
||||||
|
sidebar: true
|
||||||
layout: core
|
layout: core
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
title: Compass Layout
|
title: Compass Layout
|
||||||
crumb: Layout
|
crumb: Layout
|
||||||
framework: compass
|
framework: compass
|
||||||
|
sidebar: true
|
||||||
stylesheet: compass/_layout.scss
|
stylesheet: compass/_layout.scss
|
||||||
meta_description: Page layout module. So far, this is just the sticky-footer mixin.
|
meta_description: Page layout module. So far, this is just the sticky-footer mixin.
|
||||||
layout: core
|
layout: core
|
||||||
|
@ -4,6 +4,7 @@ crumb: Reset
|
|||||||
framework: compass
|
framework: compass
|
||||||
stylesheet: compass/_reset.scss
|
stylesheet: compass/_reset.scss
|
||||||
layout: core
|
layout: core
|
||||||
|
sidebar: true
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
- core
|
- core
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
title: Compass Utilities
|
title: Compass Utilities
|
||||||
crumb: Utilities
|
crumb: Utilities
|
||||||
framework: compass
|
framework: compass
|
||||||
|
sidebar: true
|
||||||
stylesheet: compass/_utilities.scss
|
stylesheet: compass/_utilities.scss
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
|
@ -3,8 +3,8 @@ title: Compass General Utilities
|
|||||||
crumb: General
|
crumb: General
|
||||||
framework: compass
|
framework: compass
|
||||||
stylesheet: compass/utilities/_general.scss
|
stylesheet: compass/utilities/_general.scss
|
||||||
|
sidebar: true
|
||||||
layout: core
|
layout: core
|
||||||
nav_stylesheet: compass/_utilities.scss
|
|
||||||
meta_description: Generally useful utilities that don't fit elsewhere.
|
meta_description: Generally useful utilities that don't fit elsewhere.
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
|
@ -4,7 +4,6 @@ crumb: Clearfix
|
|||||||
framework: compass
|
framework: compass
|
||||||
stylesheet: compass/utilities/general/_clearfix.scss
|
stylesheet: compass/utilities/general/_clearfix.scss
|
||||||
layout: core
|
layout: core
|
||||||
nav_stylesheet: compass/_utilities.scss
|
|
||||||
meta_description: Mixins for clearfixing.
|
meta_description: Mixins for clearfixing.
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
|
@ -4,7 +4,6 @@ crumb: Float
|
|||||||
framework: compass
|
framework: compass
|
||||||
stylesheet: compass/utilities/general/_float.scss
|
stylesheet: compass/utilities/general/_float.scss
|
||||||
layout: core
|
layout: core
|
||||||
nav_stylesheet: compass/_utilities.scss
|
|
||||||
meta_description: Mixins for cross-browser floats.
|
meta_description: Mixins for cross-browser floats.
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
|
@ -4,7 +4,6 @@ crumb: Hacks
|
|||||||
framework: compass
|
framework: compass
|
||||||
stylesheet: compass/utilities/general/_hacks.scss
|
stylesheet: compass/utilities/general/_hacks.scss
|
||||||
layout: core
|
layout: core
|
||||||
nav_stylesheet: compass/_utilities.scss
|
|
||||||
meta_description: Mixins for hacking specific browsers.
|
meta_description: Mixins for hacking specific browsers.
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
|
@ -5,7 +5,6 @@ framework: compass
|
|||||||
stylesheet: compass/utilities/general/_min.scss
|
stylesheet: compass/utilities/general/_min.scss
|
||||||
layout: core
|
layout: core
|
||||||
meta_description: Mixins for cross-browser min-height and min-width.
|
meta_description: Mixins for cross-browser min-height and min-width.
|
||||||
nav_stylesheet: compass/_utilities.scss
|
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
- core
|
- core
|
||||||
|
@ -5,7 +5,6 @@ framework: compass
|
|||||||
stylesheet: compass/utilities/general/_reset.scss
|
stylesheet: compass/utilities/general/_reset.scss
|
||||||
layout: core
|
layout: core
|
||||||
meta_description: Mixins for resetting elements (old import).
|
meta_description: Mixins for resetting elements (old import).
|
||||||
nav_stylesheet: compass/_utilities.scss
|
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
- core
|
- core
|
||||||
|
@ -5,7 +5,6 @@ framework: compass
|
|||||||
stylesheet: compass/utilities/general/_tag-cloud.scss
|
stylesheet: compass/utilities/general/_tag-cloud.scss
|
||||||
layout: core
|
layout: core
|
||||||
meta_description: Mixin for styling tag clouds.
|
meta_description: Mixin for styling tag clouds.
|
||||||
nav_stylesheet: compass/_utilities.scss
|
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
- core
|
- core
|
||||||
|
@ -3,8 +3,8 @@ title: Compass Links
|
|||||||
crumb: Links
|
crumb: Links
|
||||||
framework: compass
|
framework: compass
|
||||||
stylesheet: compass/utilities/_links.scss
|
stylesheet: compass/utilities/_links.scss
|
||||||
|
sidebar: true
|
||||||
layout: core
|
layout: core
|
||||||
nav_stylesheet: compass/_utilities.scss
|
|
||||||
meta_description: Tools for styling anchor links.
|
meta_description: Tools for styling anchor links.
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
|
@ -5,7 +5,6 @@ framework: compass
|
|||||||
stylesheet: compass/utilities/links/_hover-link.scss
|
stylesheet: compass/utilities/links/_hover-link.scss
|
||||||
layout: core
|
layout: core
|
||||||
meta_description: Underline a link when you hover over it.
|
meta_description: Underline a link when you hover over it.
|
||||||
nav_stylesheet: compass/_utilities.scss
|
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
- core
|
- core
|
||||||
|
@ -5,7 +5,6 @@ framework: compass
|
|||||||
stylesheet: compass/utilities/links/_link-colors.scss
|
stylesheet: compass/utilities/links/_link-colors.scss
|
||||||
layout: core
|
layout: core
|
||||||
meta_description: Easy assignment of colors to link states.
|
meta_description: Easy assignment of colors to link states.
|
||||||
nav_stylesheet: compass/_utilities.scss
|
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
- core
|
- core
|
||||||
|
@ -5,7 +5,6 @@ framework: compass
|
|||||||
stylesheet: compass/utilities/links/_unstyled-link.scss
|
stylesheet: compass/utilities/links/_unstyled-link.scss
|
||||||
layout: core
|
layout: core
|
||||||
meta_description: Make a link appear like regular text.
|
meta_description: Make a link appear like regular text.
|
||||||
nav_stylesheet: compass/_utilities.scss
|
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
- core
|
- core
|
||||||
|
@ -3,8 +3,8 @@ title: Compass Lists
|
|||||||
crumb: Lists
|
crumb: Lists
|
||||||
framework: compass
|
framework: compass
|
||||||
stylesheet: compass/utilities/_lists.scss
|
stylesheet: compass/utilities/_lists.scss
|
||||||
|
sidebar: true
|
||||||
layout: core
|
layout: core
|
||||||
nav_stylesheet: compass/_utilities.scss
|
|
||||||
meta_description: Tools for styling lists.
|
meta_description: Tools for styling lists.
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
|
@ -5,7 +5,6 @@ framework: compass
|
|||||||
stylesheet: compass/utilities/lists/_bullets.scss
|
stylesheet: compass/utilities/lists/_bullets.scss
|
||||||
layout: core
|
layout: core
|
||||||
meta_description: Mixins for managing list bullets.
|
meta_description: Mixins for managing list bullets.
|
||||||
nav_stylesheet: compass/_utilities.scss
|
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
- core
|
- core
|
||||||
|
@ -5,7 +5,6 @@ framework: compass
|
|||||||
stylesheet: compass/utilities/lists/_horizontal-list.scss
|
stylesheet: compass/utilities/lists/_horizontal-list.scss
|
||||||
layout: core
|
layout: core
|
||||||
meta_description: Float a list so it appears horizontally.
|
meta_description: Float a list so it appears horizontally.
|
||||||
nav_stylesheet: compass/_utilities.scss
|
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
- core
|
- core
|
||||||
|
@ -5,7 +5,6 @@ framework: compass
|
|||||||
stylesheet: compass/utilities/lists/_inline-block-list.scss
|
stylesheet: compass/utilities/lists/_inline-block-list.scss
|
||||||
layout: core
|
layout: core
|
||||||
meta_description: set list-elements to inline-block so they appear horizontally while retaining their structure.
|
meta_description: set list-elements to inline-block so they appear horizontally while retaining their structure.
|
||||||
nav_stylesheet: compass/_utilities.scss
|
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
- core
|
- core
|
||||||
|
@ -5,7 +5,6 @@ framework: compass
|
|||||||
stylesheet: compass/utilities/lists/_inline-list.scss
|
stylesheet: compass/utilities/lists/_inline-list.scss
|
||||||
layout: core
|
layout: core
|
||||||
meta_description: Style a list as inline text.
|
meta_description: Style a list as inline text.
|
||||||
nav_stylesheet: compass/_utilities.scss
|
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
- core
|
- core
|
||||||
|
@ -5,7 +5,6 @@ framework: compass
|
|||||||
stylesheet: compass/utilities/_print.scss
|
stylesheet: compass/utilities/_print.scss
|
||||||
layout: core
|
layout: core
|
||||||
meta_description: Control what elements gets printed.
|
meta_description: Control what elements gets printed.
|
||||||
nav_stylesheet: compass/_utilities.scss
|
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
- core
|
- core
|
||||||
|
@ -3,9 +3,9 @@ title: Compass Sprites
|
|||||||
crumb: Sprites
|
crumb: Sprites
|
||||||
framework: compass
|
framework: compass
|
||||||
stylesheet: compass/utilities/_sprites.scss
|
stylesheet: compass/utilities/_sprites.scss
|
||||||
|
sidebar: true
|
||||||
layout: core
|
layout: core
|
||||||
meta_description: Sprite mixins.
|
meta_description: Sprite mixins.
|
||||||
nav_stylesheet: compass/_utilities.scss
|
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
- core
|
- core
|
||||||
|
@ -4,7 +4,6 @@ crumb: Sprite Base
|
|||||||
framework: compass
|
framework: compass
|
||||||
stylesheet: compass/utilities/sprites/_base.scss
|
stylesheet: compass/utilities/sprites/_base.scss
|
||||||
layout: core
|
layout: core
|
||||||
nav_stylesheet: compass/_utilities.scss
|
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
- core
|
- core
|
||||||
|
@ -4,7 +4,6 @@ crumb: Sprite Image
|
|||||||
framework: compass
|
framework: compass
|
||||||
stylesheet: compass/utilities/sprites/_sprite-img.scss
|
stylesheet: compass/utilities/sprites/_sprite-img.scss
|
||||||
layout: core
|
layout: core
|
||||||
nav_stylesheet: compass/_utilities.scss
|
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
- core
|
- core
|
||||||
|
@ -4,8 +4,8 @@ crumb: Tables
|
|||||||
framework: compass
|
framework: compass
|
||||||
stylesheet: compass/utilities/_tables.scss
|
stylesheet: compass/utilities/_tables.scss
|
||||||
layout: core
|
layout: core
|
||||||
|
sidebar: true
|
||||||
meta_description: Style helpers for your tables.
|
meta_description: Style helpers for your tables.
|
||||||
nav_stylesheet: compass/_utilities.scss
|
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
- core
|
- core
|
||||||
|
@ -4,7 +4,6 @@ crumb: Table Striping
|
|||||||
framework: compass
|
framework: compass
|
||||||
stylesheet: compass/utilities/tables/_alternating-rows-and-columns.scss
|
stylesheet: compass/utilities/tables/_alternating-rows-and-columns.scss
|
||||||
layout: core
|
layout: core
|
||||||
nav_stylesheet: compass/_utilities.scss
|
|
||||||
meta_description: Add striping to a table.
|
meta_description: Add striping to a table.
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
|
@ -4,7 +4,6 @@ crumb: Table Borders
|
|||||||
framework: compass
|
framework: compass
|
||||||
stylesheet: compass/utilities/tables/_borders.scss
|
stylesheet: compass/utilities/tables/_borders.scss
|
||||||
layout: core
|
layout: core
|
||||||
nav_stylesheet: compass/_utilities.scss
|
|
||||||
meta_description: Add borders to a table.
|
meta_description: Add borders to a table.
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
|
@ -4,7 +4,6 @@ crumb: Table Scaffolding
|
|||||||
framework: compass
|
framework: compass
|
||||||
stylesheet: compass/utilities/tables/_scaffolding.scss
|
stylesheet: compass/utilities/tables/_scaffolding.scss
|
||||||
layout: core
|
layout: core
|
||||||
nav_stylesheet: compass/_utilities.scss
|
|
||||||
meta_description: Basic styling of tables to get you started.
|
meta_description: Basic styling of tables to get you started.
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
|
@ -4,8 +4,8 @@ crumb: Text
|
|||||||
framework: compass
|
framework: compass
|
||||||
stylesheet: compass/utilities/_text.scss
|
stylesheet: compass/utilities/_text.scss
|
||||||
layout: core
|
layout: core
|
||||||
|
sidebar: true
|
||||||
meta_description: Style helpers for your text.
|
meta_description: Style helpers for your text.
|
||||||
nav_stylesheet: compass/_utilities.scss
|
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
- core
|
- core
|
||||||
|
@ -4,7 +4,6 @@ crumb: Ellipsis
|
|||||||
framework: compass
|
framework: compass
|
||||||
stylesheet: compass/utilities/text/_ellipsis.scss
|
stylesheet: compass/utilities/text/_ellipsis.scss
|
||||||
layout: core
|
layout: core
|
||||||
nav_stylesheet: compass/_utilities.scss
|
|
||||||
meta_description: Text truncation with ellipsis.
|
meta_description: Text truncation with ellipsis.
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
|
@ -5,7 +5,6 @@ framework: compass
|
|||||||
stylesheet: compass/utilities/text/_nowrap.scss
|
stylesheet: compass/utilities/text/_nowrap.scss
|
||||||
layout: core
|
layout: core
|
||||||
meta_description: Remembering whether or not there's a hyphen in white-space is too hard.
|
meta_description: Remembering whether or not there's a hyphen in white-space is too hard.
|
||||||
nav_stylesheet: compass/_utilities.scss
|
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
- core
|
- core
|
||||||
|
@ -5,7 +5,6 @@ framework: compass
|
|||||||
stylesheet: compass/utilities/text/_replacement.scss
|
stylesheet: compass/utilities/text/_replacement.scss
|
||||||
layout: core
|
layout: core
|
||||||
meta_description: Replace text with images.
|
meta_description: Replace text with images.
|
||||||
nav_stylesheet: compass/_utilities.scss
|
|
||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
- core
|
- core
|
||||||
|
@ -16,6 +16,12 @@ aside {
|
|||||||
a {
|
a {
|
||||||
font-size: .85em;
|
font-size: .85em;
|
||||||
}
|
}
|
||||||
|
ul ul a {
|
||||||
|
&.selected, &.selected:hover {
|
||||||
|
font-weight: bold;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
}
|
||||||
.deprecated {
|
.deprecated {
|
||||||
text-decoration: line-through;
|
text-decoration: line-through;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
- render 'main' do
|
- 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
|
%article= yield
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
- render 'main' do
|
- render 'main' do
|
||||||
- content_for :module_nav do
|
- content_for :module_nav do
|
||||||
%ul= item_tree(reference_item(:stylesheet => "compass.scss"), :depth => 1, :omit_self => true, :headings => false)
|
%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
|
%article= yield
|
@ -1,2 +1,5 @@
|
|||||||
%nav#local-nav
|
%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})
|
||||||
|
@ -61,6 +61,21 @@ end
|
|||||||
def get_var(instance_var)
|
def get_var(instance_var)
|
||||||
instance_variable_defined?("@#{instance_var}") ? instance_variable_get("@#{instance_var}") : yield
|
instance_variable_defined?("@#{instance_var}") ? instance_variable_get("@#{instance_var}") : yield
|
||||||
end
|
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 = {})
|
def item_tree(item, options = {})
|
||||||
@ -70,6 +85,7 @@ def item_tree(item, options = {})
|
|||||||
if options.fetch(:depth,1) > 0
|
if options.fetch(:depth,1) > 0
|
||||||
child_opts = options.dup
|
child_opts = options.dup
|
||||||
child_opts[:depth] -= 1 if child_opts.has_key?(:depth)
|
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[:heading_level] += 1 if child_opts[:heading_level]
|
||||||
child_opts.delete(:omit_self)
|
child_opts.delete(:omit_self)
|
||||||
item.children.sort_by{|c| c[:crumb] || c[:title]}.each do |child|
|
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],
|
:selected => !!@item.identifier[item.identifier],
|
||||||
:crumb => item[:crumb] || item[:title]
|
:crumb => item[:crumb] || item[:title]
|
||||||
}
|
}
|
||||||
if options[:heading_level]
|
if options[:heading_level] && (options.fetch(:heading_depth, 1) > 0)
|
||||||
render("partials/sidebar/heading",
|
render("partials/sidebar/heading",
|
||||||
item_opts.merge(:heading => "h#{options[:heading_level]}")
|
item_opts.merge(:heading => "h#{options[:heading_level]}")
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user