Created
January 31, 2009 23:35
-
-
Save ihower/55707 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# HTML (from http://960.gs/ code example) | |
<div class="container_12"> | |
<div class="grid_7 prefix_1"> | |
<div class="grid_2 alpha"> | |
<p>...</p> | |
</div> | |
<div class="grid_3"> | |
<p>...</p> | |
</div> | |
<div class="grid_2 omega"> | |
<p>...</p> | |
</div> | |
</div> | |
<div class="grid_3 suffix_1"> | |
<p>...</p> | |
</div> | |
</div> | |
<hr> | |
# Erb | |
<% container 12 do %> | |
<% grid 7, :prefix => 1 do %> | |
<% grid 2, :first => true do %> | |
<p>...</p> | |
<% end -%> | |
<% grid 3 do %> | |
<p>...</p> | |
<% end -%> | |
<% grid 2, :last => true do %> | |
<p>...</p> | |
<% end -%> | |
<% end -%> | |
<% grid 3, :suffix => 1 do %> | |
<p>...</p> | |
<% end -%> | |
<% end -%> | |
# Haml | |
- container 12 do | |
- grid 7, :prefix => 1 do | |
- grid 2, :first => true do | |
%p ... | |
- grid 3 do | |
%p ... | |
- grid 2, :last => true do | |
%p ... | |
- grid 3, :suffix => 1 do | |
%p ... | |
# Helper | |
def container(rows, options = {}, &block) | |
content = capture(&block) | |
concat(content_tag("div", content, :class => "container_#{rows}" )) | |
end | |
def grid(rows, options = {}, &block) | |
content = capture(&block) | |
# TODO | |
# options[:prefix] | |
# options[:suffix] | |
# options[:first] | |
# options[:last] | |
concat(content_tag("div", content, :class => "grid_#{rows}" )) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment