List all the reference content in the sidebar.

This commit is contained in:
Chris Eppstein 2010-02-03 08:02:27 -08:00
parent 76e2e5217b
commit 467bc9ebd7
13 changed files with 52 additions and 29 deletions

View File

@ -1,6 +1,6 @@
---
title: Compass Tag_cloud
crumb: Tag_cloud
crumb: Tag Cloud
framework: compass
stylesheet: compass/utilities/general/_tag_cloud.sass
classnames:

View File

@ -1,6 +1,6 @@
---
title: Compass Hover_link
crumb: Hover_link
title: Compass Hover Link
crumb: Hover Link
framework: compass
stylesheet: compass/utilities/links/_hover_link.sass
classnames:

View File

@ -1,6 +1,6 @@
---
title: Compass Link_colors
crumb: Link_colors
title: Compass Link Colors
crumb: Link Colors
framework: compass
stylesheet: compass/utilities/links/_link_colors.sass
classnames:

View File

@ -1,6 +1,6 @@
---
title: Compass Unstyled_link
crumb: Unstyled_link
title: Compass Unstyled Link
crumb: Unstyled Link
framework: compass
stylesheet: compass/utilities/links/_unstyled_link.sass
classnames:

View File

@ -1,6 +1,6 @@
---
title: Compass Horizontal_list
crumb: Horizontal_list
title: Compass Horizontal List
crumb: Horizontal List
framework: compass
stylesheet: compass/utilities/lists/_horizontal_list.sass
classnames:

View File

@ -1,6 +1,6 @@
---
title: Compass Inline_list
crumb: Inline_list
title: Compass Inline List
crumb: Inline List
framework: compass
stylesheet: compass/utilities/lists/_inline_list.sass
classnames:

View File

@ -1,6 +1,6 @@
---
title: Compass Sprite_img
crumb: Sprite_img
title: Compass Sprite Image
crumb: Sprite Image
framework: compass
stylesheet: compass/utilities/sprites/_sprite_img.sass
classnames:

View File

@ -1,6 +1,6 @@
---
title: Compass Alternating_rows_and_columns
crumb: Alternating_rows_and_columns
title: Compass Alternating Rows and Columns
crumb: Alternating Rows And Columns
framework: compass
stylesheet: compass/utilities/tables/_alternating_rows_and_columns.sass
classnames:

View File

@ -12,11 +12,11 @@ body
+container
#main
+column(18, true)
+prepend(6)
+column(16, true)
+prepend(8)
#sidebar
+column(6)
+column(8)
+pull(24, true)
body.reference

View File

@ -14,11 +14,7 @@
#main
= yield
#sidebar
%h2
Compass Documentation
%ul
%li= link_to "Blueprint Reference", reference_path(:stylesheet => "_blueprint.sass")
%li= link_to "Compass Reference", reference_path(:stylesheet => "_compass.sass")
= render "partials/sidebar"
#footer= @item[:content_for_footer]
:javascript
$(function(){

View File

@ -0,0 +1,5 @@
%h2
Compass Documentation
%ul
= item_tree(reference_item(:stylesheet => "_blueprint.sass"))
= item_tree(reference_item(:stylesheet => "_compass.sass"))

View File

@ -46,3 +46,22 @@ end
def cycle(*args)
yield Recycler.new *args
end
def default_path(item)
item.reps.find{|r| r.name == :default}.path
end
def item_tree(item)
crumb = item[:crumb] || item[:title]
child_html = ""
if item.children.any?
child_html << "<ol>"
item.children.each do |child|
child_html << item_tree(child)
end
child_html << "</ol>"
end
%Q{<li><a href="#{default_path(item)}">#{crumb}</a>#{child_html}</li>}
end

View File

@ -28,18 +28,21 @@ def imports(item)
imports
end
def reference_path(options)
def reference_item(options)
stylesheet = options[:stylesheet]
path = stylesheet_path(stylesheet)
if path
item = @items.detect do |i|
@items.detect do |i|
i[:stylesheet] == path &&
i.identifier =~ /^\/reference/
end
if item
rep = item.reps.find { |r| r.name == :default }
rep.path
end
end
end
def reference_path(options)
if item = reference_item(options)
rep = item.reps.find { |r| r.name == :default }
rep.path
end
end