More nav context awareness
This commit is contained in:
parent
523f742ca9
commit
c7d274394b
@ -7,6 +7,7 @@ layout: core
|
|||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
- core
|
- core
|
||||||
|
- css3
|
||||||
meta_description: Provides cross browser CSS3 mixins that take advantage of available pre-spec vendor prefixes.
|
meta_description: Provides cross browser CSS3 mixins that take advantage of available pre-spec vendor prefixes.
|
||||||
layout: core
|
layout: core
|
||||||
---
|
---
|
||||||
|
@ -8,6 +8,7 @@ layout: core
|
|||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
- core
|
- core
|
||||||
|
- layout
|
||||||
---
|
---
|
||||||
- render 'reference' do
|
- render 'reference' do
|
||||||
%p
|
%p
|
||||||
|
@ -8,6 +8,7 @@ layout: core
|
|||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
- core
|
- core
|
||||||
|
- misc
|
||||||
---
|
---
|
||||||
- render 'reference' do
|
- render 'reference' do
|
||||||
%p
|
%p
|
||||||
|
@ -7,6 +7,7 @@ layout: core
|
|||||||
classnames:
|
classnames:
|
||||||
- reference
|
- reference
|
||||||
- core
|
- core
|
||||||
|
- reset
|
||||||
meta_description: Adds a CSS Reset into your stylesheet.
|
meta_description: Adds a CSS Reset into your stylesheet.
|
||||||
---
|
---
|
||||||
- render 'reference' do
|
- render 'reference' do
|
||||||
|
@ -193,6 +193,18 @@ article
|
|||||||
+ #page
|
+ #page
|
||||||
+leader(1.5)
|
+leader(1.5)
|
||||||
|
|
||||||
|
=active-module($type, $url)
|
||||||
|
body#{$type} #module-nav a[href^="#{$url}"]
|
||||||
|
&:link, &:visited
|
||||||
|
text-decoration: underline
|
||||||
|
+text-shadow
|
||||||
|
|
||||||
|
+active-module(".core.css3", "/docs/reference/compass/css3/")
|
||||||
|
+active-module(".core.layout", "/docs/reference/compass/layout/")
|
||||||
|
+active-module(".core.misc", "/docs/reference/compass/misc/")
|
||||||
|
+active-module(".core.reset", "/docs/reference/compass/reset/")
|
||||||
|
+active-module(".core.utilities", "/docs/reference/compass/utilities/")
|
||||||
|
|
||||||
#local-nav
|
#local-nav
|
||||||
+leader(1,14px)
|
+leader(1,14px)
|
||||||
ul
|
ul
|
||||||
@ -204,6 +216,12 @@ article
|
|||||||
margin-bottom: ($base_rhythm_unit*.5 - $px2em*1px) * (14/16)
|
margin-bottom: ($base_rhythm_unit*.5 - $px2em*1px) * (14/16)
|
||||||
a:hover
|
a:hover
|
||||||
+text-shadow
|
+text-shadow
|
||||||
|
a.selected
|
||||||
|
font-weight: bold
|
||||||
|
a.selected:before
|
||||||
|
content: "»"
|
||||||
|
a.selected:after
|
||||||
|
content: "«"
|
||||||
|
|
||||||
#code
|
#code
|
||||||
+full(12)
|
+full(12)
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
- render 'main' do
|
- 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"
|
||||||
%article= yield
|
%article= yield
|
@ -44,6 +44,8 @@
|
|||||||
%p
|
%p
|
||||||
%label{:for => "search"} search
|
%label{:for => "search"} search
|
||||||
%input#search{:name => "search", :type => "text", :value => "", :placeholder => "Search"}
|
%input#search{:name => "search", :type => "text", :value => "", :placeholder => "Search"}
|
||||||
|
- if @item[:content_for_module_nav]
|
||||||
|
%nav#module-nav= @item[:content_for_module_nav]
|
||||||
= yield
|
= yield
|
||||||
%script(src="/docs/javascripts/jquery-1.3.2.min.js")
|
%script(src="/docs/javascripts/jquery-1.3.2.min.js")
|
||||||
%script(src="/docs/javascripts/jquery-ui-1.7.2.custom.min.js")
|
%script(src="/docs/javascripts/jquery-ui-1.7.2.custom.min.js")
|
||||||
|
@ -57,7 +57,7 @@ end
|
|||||||
|
|
||||||
def item_tree(item, options = {})
|
def item_tree(item, options = {})
|
||||||
crumb = item[:crumb] || item[:title]
|
crumb = item[:crumb] || item[:title]
|
||||||
options[:heading_level] ||= 1
|
options[:heading_level] ||= 1 if options.fetch(:headings, true)
|
||||||
child_html = ""
|
child_html = ""
|
||||||
if options.fetch(:depth,1) > 0
|
if options.fetch(:depth,1) > 0
|
||||||
if item.children.any?
|
if item.children.any?
|
||||||
@ -65,7 +65,7 @@ def item_tree(item, options = {})
|
|||||||
item.children.sort_by{|c| c[:crumb] || c[:title]}.each do |child|
|
item.children.sort_by{|c| c[:crumb] || c[:title]}.each do |child|
|
||||||
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_level] += 1
|
child_opts[:heading_level] += 1 if child_opts[:heading_level]
|
||||||
child_opts.delete(:omit_self)
|
child_opts.delete(:omit_self)
|
||||||
child_html << item_tree(child, child_opts)
|
child_html << item_tree(child, child_opts)
|
||||||
end
|
end
|
||||||
@ -79,8 +79,6 @@ def item_tree(item, options = {})
|
|||||||
suffix = nil
|
suffix = nil
|
||||||
if item.identifier == @item.identifier
|
if item.identifier == @item.identifier
|
||||||
css_class = %Q{class="selected"}
|
css_class = %Q{class="selected"}
|
||||||
prefix = "»"
|
|
||||||
suffix = "«"
|
|
||||||
end
|
end
|
||||||
contents = unless options[:omit_self]
|
contents = unless options[:omit_self]
|
||||||
hl = if options[:heading_level]
|
hl = if options[:heading_level]
|
||||||
@ -88,7 +86,7 @@ def item_tree(item, options = {})
|
|||||||
else
|
else
|
||||||
"span"
|
"span"
|
||||||
end
|
end
|
||||||
%Q{<li><#{hl}><a href="#{default_path(item)}"#{css_class}>#{prefix}#{crumb}#{suffix}</a></#{hl}></li>}
|
%Q{<li><#{hl}><a href="#{default_path(item)}"#{css_class}>#{crumb}</a></#{hl}></li>}
|
||||||
end
|
end
|
||||||
%Q{#{contents}#{child_html}}
|
%Q{#{contents}#{child_html}}
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user