Class: Forme::InputsWrapper::Bs5Table
- Inherits:
-
Object
- Object
- Forme::InputsWrapper::Bs5Table
- Defined in:
- lib/forme/bs5.rb
Overview
Use a <table class=“table”> tag to wrap the inputs.
Registered as :bs5_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.
100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/forme/bs5.rb', line 100 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.tag(:caption, opts[:legend_attr], legend) end if (labels = opts[:labels]) && !labels.empty? form.tag(:tr, {}, labels.map{|l| form._tag(:th, {}, l)}) end yield end end |