Module YUIPages
In: lib/yui_pages.rb

Methods

Constants

PAGE_750 = "doc"
PAGE_950 = "doc2"
PAGE_974 = "doc4"
PAGE_FLUID = "doc3"
LEFT_160 = "yui-t1"
LEFT_180 = "yui-t2"
LEFT_300 = "yui-t3"
RIGHT_180 = "yui-t4"
RIGHT_240 = "yui-t5"
RIGHT_300 = "yui-t6"
GRID_50_50 = "yui-g"
GRID_33_33_33 = "yui-gb"
GRID_67_33 = "yui-gc"
GRID_33_67 = "yui-gd"
GRID_75_25 = "yui-ge"
GRID_25_75 = "yui-gf"

Public Instance methods

Wrap a block in a div marked as the page body content.

[Source]

    # File lib/yui_pages.rb, line 53
53:   def body(&block)
54:     concat(content_tag(:div, capture(&block), :id => "bd"), block.binding)
55:   end

Wrap a block in a div marked at footer.

[Source]

    # File lib/yui_pages.rb, line 58
58:   def footer(&block)
59:     concat(content_tag(:div, capture(&block), :id => "ft"), block.binding)
60:   end

Create a YUI grid. The optional options[:columns] value specifies the number of columns and their widths (defaults to two columns split 50/50).

Valid values for options[:columns] are GRID_50_50, GRID_33_33_33, GRID_67_33, GRID_33_67, GRID_75_25 and GRID_25_75.

[Source]

    # File lib/yui_pages.rb, line 79
79:   def grid(options = {}, &block)
80:     options = { :columns => GRID_50_50 }.merge(options)
81: 
82:     class_first = @in_grid && @grid_first
83:     @grid_first = true
84: 
85:     with_in_grid(true) do
86:       results = capture(&block)
87:     end
88: 
89:     @grid_first = !class_first
90: 
91:     concat(content_tag(:div, results, :class => class_first ? "#{options[:columns]} first" : options[:columns]), block.binding)
92:   end

Wrap a block in a div marked at header.

[Source]

    # File lib/yui_pages.rb, line 48
48:   def header(&block)
49:     concat(content_tag(:div, capture(&block), :id => "hd"), block.binding)
50:   end

Used inside the body block. Wrap a block in a div marked as the main page content (as opposed to the secondary/sidebar page content).

[Source]

    # File lib/yui_pages.rb, line 64
64:   def main(&block)
65:     concat(content_tag(:div, content_tag(:div, capture(&block), :class => "yui-b"), :id => "yui-main"), block.binding)
66:   end

Used inside the body block. Wrap a block in a div marked as the secondary/sidebar page content

[Source]

    # File lib/yui_pages.rb, line 70
70:   def secondary(&block)
71:     concat(content_tag(:div, capture(&block), :class => "yui-b"), block.binding)
72:   end

Specifies a unit (a.k.a. column) inside a grid. If this unit itself is subdivided into another grid, use the grid helper directly instead.

[Source]

     # File lib/yui_pages.rb, line 96
 96:   def unit(&block)
 97:     with_in_grid(false) do
 98:       results = capture(&block)
 99:     end
100: 
101:     concat(content_tag(:div, results, :class => @grid_first ? "yui-u first" : "yui-u"), block.binding)
102:     @grid_first = false
103:   end

Inserts stylesheet link tags to the compressed YUI Resets and YUI Grids CSS files on Yahoo‘s servers.

[Source]

    # File lib/yui_pages.rb, line 25
25:   def yui_grids_stylesheet_link_tags
26:     stylesheet_link_tag(
27:       "http://yui.yahooapis.com/2.4.0/build/reset/reset-min.css",
28:       "http://yui.yahooapis.com/2.4.0/build/grids/grids-min.css"
29:     )
30:   end

Inserts a div tag to wrap an entire YUI Grids-based page. Specify a page width constant in options[:width] (defaults to 950px) and a secondary content block arrangement constant in options[:secondary] (defaults to none).

Valid values for options[:width] are PAGE_750, PAGE_950, PAGE_974 and PAGE_FLUID.

Valid values for options[:secondary] are LEFT_160, LEFT_180, LEFT_300, RIGHT_180, RIGHT_240 and RIGHT_300.

[Source]

    # File lib/yui_pages.rb, line 42
42:   def yui_page(options = {}, &block)
43:     options = { :width => PAGE_950, :secondary => nil }.merge(options)
44:     concat(content_tag(:div, capture(&block), :id => options[:width], :class => "#{options[:secondary]} outer"), block.binding)
45:   end

[Validate]