Class: Forme::InputsWrapper::Bs3Table
- Inherits:
-
Object
- Object
- Forme::InputsWrapper::Bs3Table
- Defined in:
- lib/forme/bs3.rb
Overview
Use a <table class=“table”> tag to wrap the inputs.
Registered as :bs3_table.
Instance Method Summary collapse
-
#call(form, opts, &block) ⇒ Object
Wrap the inputs in a <table> tag.
Instance Method Details
#call(form, opts, &block) ⇒ Object
Wrap the inputs in a <table> tag.
229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
# File 'lib/forme/bs3.rb', line 229 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 |