class Forme::InputsWrapper::Bs3Table

  1. lib/forme/bs3.rb
Superclass: Object

Use a <table class=“table”> tag to wrap the inputs.

Registered as :bs3_table.

Methods

Public Instance

  1. call

Public Instance methods

call (form, opts, &block)

Wrap the inputs in a <table> tag.

[show source]
# File lib/forme/bs3.rb, line 233
def call(form, opts, &block)
  attr = opts[:attr] ? opts[:attr].dup : { :class=>'table table-bordered'}
  form.tag(:table, attr) do
    if legend = opts[:legend]
      form.emit(form.tag(:caption, opts[:legend_attr], legend))
    end

    if (labels = opts[:labels]) && !labels.empty?
      form.emit(form.tag(:tr, {}, labels.map{|l| form._tag(:th, {}, l)}))
    end

    yield
  end
end