Don't use a table for constants -- too hard to read.

This commit is contained in:
Chris Eppstein 2010-03-17 08:42:40 -07:00
parent 6a1c1c8c3d
commit 41f1f30e0f
3 changed files with 41 additions and 36 deletions

View File

@ -52,19 +52,31 @@ table.datagrid
// Reference // Reference
body.reference body.reference
h3.mixin h3
background-color: #eee &.mixin, &.constant
border: 1px solid #aaa font-family: Monaco, courier
padding: 0.75em font-weight: 200
margin-bottom: 0 +text-shadow
a.permalink background-color: #eee
+hover-link border: 1px solid #aaa
+link-colors("inherit", "inherit") padding: 0.75em
margin-bottom: 0
a.permalink
+hover-link
+link-colors("inherit", "inherit")
.source-documentation .source-documentation
background-color: #eee background-color: #eee
border: 1px solid #aaa border: 1px solid #aaa
border-top-width: 0 border-top-width: 0
padding: 0.75em padding: 0.75em
dl.source-documentation
margin-top: 0
dt
font-weight: bold
float: left
margin-right: 15px
dt:not(:first-child)
margin-top: 1em
a.view-source a.view-source
float: right float: right
margin: 1.25em margin: 1.25em

View File

@ -0,0 +1,10 @@
- constants.each do |constant_def|
- const_id = constant_def.name.gsub(/_/,'-')
%h3.constant{:id=>"const-#{const_id}"}
%a.permalink{:href => "#const-#{const_id}"}= "!"+constant_def.name
%dl.constant-details.source-documentation
%dt Value
%dd= constant_def.expr.to_sass(:html)
- if constant_def.comment
%dt Description
%dd= format_doc constant_def.comment

View File

@ -1,29 +1,12 @@
- if (constant_defs = constants(@item)).any? - if (constant_defs = constants(@item)).any?
%h2 Constants - variables = constant_defs.select{|d| d.guarded }
- show_description = constant_defs.detect{|d| d.comment } && true - constants = constant_defs.reject{|d| d.guarded }
- cycle 'even', 'odd' do |row_classes| - if variables.any?
- cycle 'even', 'odd' do |col_classes| %h2
%table.constants{:cellspacing => "0", :cellpadding=>"0", :border => "0"} Configurable Variables
%thead %a(href="/docs/tutorials/configurable-variables/" class="help") help
%tr{:class => row_classes.next} = render "partials/reference/const_table", :constants => variables
%th{:class => col_classes.next} Constant
%th{:class => col_classes.next} Value - if constants.any?
- if show_description %h2 Constants
%th{:class => col_classes.next} Description = render "partials/reference/const_table", :constants => constants
%th{:class => col_classes.next} Configurable?
- col_classes.reset!
- constant_defs.each do |constant_def|
%tr{:class => row_classes.next}
%td{:class => col_classes.next}
%code= "!"+constant_def.name
%td{:class => col_classes.next}
%code= constant_def.expr.to_sass(:html)
- if show_description
%td{:class => col_classes.next}
- if constant_def.comment
= format_doc constant_def.comment
- else
 
%td{:class => col_classes.next}
%code= constant_def.guarded ? "Y" : "N"
- col_classes.reset!