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,7 +52,11 @@ table.datagrid
// Reference // Reference
body.reference body.reference
h3.mixin h3
&.mixin, &.constant
font-family: Monaco, courier
font-weight: 200
+text-shadow
background-color: #eee background-color: #eee
border: 1px solid #aaa border: 1px solid #aaa
padding: 0.75em padding: 0.75em
@ -65,6 +69,14 @@ body.reference
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?
- variables = constant_defs.select{|d| d.guarded }
- constants = constant_defs.reject{|d| d.guarded }
- if variables.any?
%h2
Configurable Variables
%a(href="/docs/tutorials/configurable-variables/" class="help") help
= render "partials/reference/const_table", :constants => variables
- if constants.any?
%h2 Constants %h2 Constants
- show_description = constant_defs.detect{|d| d.comment } && true = render "partials/reference/const_table", :constants => constants
- cycle 'even', 'odd' do |row_classes|
- cycle 'even', 'odd' do |col_classes|
%table.constants{:cellspacing => "0", :cellpadding=>"0", :border => "0"}
%thead
%tr{:class => row_classes.next}
%th{:class => col_classes.next} Constant
%th{:class => col_classes.next} Value
- if show_description
%th{:class => col_classes.next} Description
%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!