From 467bc9ebd7ecb6609f563e9e375beca20537594f Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Wed, 3 Feb 2010 08:02:27 -0800 Subject: [PATCH] List all the reference content in the sidebar. --- .../compass/utilities/general/tag_cloud.haml | 2 +- .../compass/utilities/links/hover_link.haml | 4 ++-- .../compass/utilities/links/link_colors.haml | 4 ++-- .../utilities/links/unstyled_link.haml | 4 ++-- .../utilities/lists/horizontal_list.haml | 4 ++-- .../compass/utilities/lists/inline_list.haml | 4 ++-- .../compass/utilities/sprites/sprite_img.haml | 4 ++-- .../tables/alternating_rows_and_columns.haml | 4 ++-- doc-src/content/stylesheets/main.sass | 6 +++--- doc-src/layouts/default.haml | 6 +----- doc-src/layouts/partials/sidebar.haml | 5 +++++ doc-src/lib/default.rb | 19 +++++++++++++++++++ doc-src/lib/stylesheets.rb | 15 +++++++++------ 13 files changed, 52 insertions(+), 29 deletions(-) create mode 100644 doc-src/layouts/partials/sidebar.haml 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 62c39a43..41c3cb11 100644 --- a/doc-src/content/reference/compass/utilities/general/tag_cloud.haml +++ b/doc-src/content/reference/compass/utilities/general/tag_cloud.haml @@ -1,6 +1,6 @@ --- title: Compass Tag_cloud -crumb: Tag_cloud +crumb: Tag Cloud framework: compass stylesheet: compass/utilities/general/_tag_cloud.sass classnames: 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 1c79136f..36a3c24b 100644 --- a/doc-src/content/reference/compass/utilities/links/hover_link.haml +++ b/doc-src/content/reference/compass/utilities/links/hover_link.haml @@ -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: 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 9491a2b4..37a2cb2d 100644 --- a/doc-src/content/reference/compass/utilities/links/link_colors.haml +++ b/doc-src/content/reference/compass/utilities/links/link_colors.haml @@ -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: 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 a014b13d..408c067d 100644 --- a/doc-src/content/reference/compass/utilities/links/unstyled_link.haml +++ b/doc-src/content/reference/compass/utilities/links/unstyled_link.haml @@ -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: 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 e444a4bf..633669ec 100644 --- a/doc-src/content/reference/compass/utilities/lists/horizontal_list.haml +++ b/doc-src/content/reference/compass/utilities/lists/horizontal_list.haml @@ -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: 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 9720d586..e3ce84df 100644 --- a/doc-src/content/reference/compass/utilities/lists/inline_list.haml +++ b/doc-src/content/reference/compass/utilities/lists/inline_list.haml @@ -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: 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 afd52f9c..81d82f02 100644 --- a/doc-src/content/reference/compass/utilities/sprites/sprite_img.haml +++ b/doc-src/content/reference/compass/utilities/sprites/sprite_img.haml @@ -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: 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 c92ef9b0..80827a4a 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 @@ -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: diff --git a/doc-src/content/stylesheets/main.sass b/doc-src/content/stylesheets/main.sass index 5e0b43b2..c49cc085 100644 --- a/doc-src/content/stylesheets/main.sass +++ b/doc-src/content/stylesheets/main.sass @@ -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 diff --git a/doc-src/layouts/default.haml b/doc-src/layouts/default.haml index acfc32a1..3b29e3e6 100644 --- a/doc-src/layouts/default.haml +++ b/doc-src/layouts/default.haml @@ -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(){ diff --git a/doc-src/layouts/partials/sidebar.haml b/doc-src/layouts/partials/sidebar.haml new file mode 100644 index 00000000..cb290885 --- /dev/null +++ b/doc-src/layouts/partials/sidebar.haml @@ -0,0 +1,5 @@ +%h2 + Compass Documentation +%ul + = item_tree(reference_item(:stylesheet => "_blueprint.sass")) + = item_tree(reference_item(:stylesheet => "_compass.sass")) diff --git a/doc-src/lib/default.rb b/doc-src/lib/default.rb index 9bb9198f..56953ade 100644 --- a/doc-src/lib/default.rb +++ b/doc-src/lib/default.rb @@ -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 << "
    " + item.children.each do |child| + child_html << item_tree(child) + end + child_html << "
" + end + %Q{
  • #{crumb}#{child_html}
  • } +end + + diff --git a/doc-src/lib/stylesheets.rb b/doc-src/lib/stylesheets.rb index 4e48f3f2..a36754e1 100644 --- a/doc-src/lib/stylesheets.rb +++ b/doc-src/lib/stylesheets.rb @@ -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