Module: Toolsmith::ViewHelpers::GridHelpers

Included in:
Toolsmith::ViewHelpers
Defined in:
lib/toolsmith/helpers/grid_helpers.rb

Instance Method Summary collapse

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> “‘

Parameters:

  • width (Fixnum)
  • options (Hash) (defaults to: {})

Returns:

  • (String)


44
45
46
47
48
49
# File 'lib/toolsmith/helpers/grid_helpers.rb', line 44

def column(width, options = {}, &block)
  classes = %W[span#{width}]
  classes << "offset#{options[:offset]}" if options[:offset]

  (: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> “‘

See Also:



69
70
71
72
73
# File 'lib/toolsmith/helpers/grid_helpers.rb', line 69

def full_width_column(options={}, &block)
  row(options) 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> “‘

Parameters:

  • options (Hash) (defaults to: {})

Returns:

  • (String)

    ‘<div class=“row”>Content</div>`



21
22
23
24
# File 'lib/toolsmith/helpers/grid_helpers.rb', line 21

def row(options={}, &block)
  row_class = options[:fluid] ? "row-fluid" : "row"
  (:div, class: row_class, &block)
end