Module: Toolsmith::ViewHelpers::GridHelpers
- Included in:
- Toolsmith::ViewHelpers
- Defined in:
- lib/toolsmith/helpers/grid_helpers.rb
Instance Method Summary collapse
-
#column(width, options = {}, &block) ⇒ String
Returns a grid column element.
-
#full_width_column(options = {}, &block) ⇒ Object
Create a row and fullwidth column (based on the standard 12 wide).
-
#row(options = {}, &block) ⇒ String
Generates a grid row.
Instance Method Details
#column(width, options = {}, &block) ⇒ String
Returns a grid column element.
“‘ <%= column 12 do %>
I'm in a column!
<% end %> “‘ Will output:
“‘ <div class=“span12”>
I'm in a column!
</div> “‘
44 45 46 47 48 49 |
# File 'lib/toolsmith/helpers/grid_helpers.rb', line 44 def column(width, = {}, &block) classes = %W[span#{width}] classes << "offset#{[:offset]}" if [:offset] content_tag(:div, class: classes, &block) end |
#full_width_column(options = {}, &block) ⇒ Object
Create a row and fullwidth column (based on the standard 12 wide)
“‘ <%= full_width_column do %>
My more-to-love column.
<% end %> “‘ Will output:
“‘ <div class=“row”>
<div class="span12">
My more-to-love column.
</div>
</div> “‘
69 70 71 72 73 |
# File 'lib/toolsmith/helpers/grid_helpers.rb', line 69 def full_width_column(={}, &block) row() do column(12, &block) end end |
#row(options = {}, &block) ⇒ String
Generates a grid row.
“‘ <%= row do %>
Content
<% end %> “‘ Will output:
“‘ <div class=“row”>
Content
</div> “‘
21 22 23 24 |
# File 'lib/toolsmith/helpers/grid_helpers.rb', line 21 def row(={}, &block) row_class = [:fluid] ? "row-fluid" : "row" content_tag(:div, class: row_class, &block) end |