Skip to content

Instantly share code, notes, and snippets.

@ihower
Created January 31, 2009 23:35
Show Gist options
  • Save ihower/55707 to your computer and use it in GitHub Desktop.
Save ihower/55707 to your computer and use it in GitHub Desktop.
# 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