Module: BootstrapHelp::TableHelpers

Includes:
ActionView::Context, ActionView::Helpers::TagHelper, ActionView::Helpers::TextHelper, ActionView::Helpers::UrlHelper
Defined in:
lib/bootstrap_help/table_helpers.rb

Instance Method Summary collapse

Instance Method Details

#column(name, value = nil, sortable = true, &block) ⇒ Object



17
18
19
20
21
# File 'lib/bootstrap_help/table_helpers.rb', line 17

def column(name, value = nil, sortable = true, &block)
  value = name unless value
  @columns << {:name => name, :value => value, :sortable => sortable, :block => block}
  nil
end

#table_for(collection, args = {}, &block) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/bootstrap_help/table_helpers.rb', line 8

def table_for(collection, args={}, &block)
  @columns = []
  @row_decorators = args[:row_decorators]
  block.call
   :table, class: "table table-striped table-bordered" do
    thead + tbody(collection)
  end
end