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