Class: Forme::InputsWrapper::Table
- Inherits:
-
Object
- Object
- Forme::InputsWrapper::Table
- Defined in:
- lib/forme/transformers/inputs_wrapper.rb
Overview
Use a <table> tag to wrap the inputs.
Registered as :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.
80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/forme/transformers/inputs_wrapper.rb', line 80 def call(form, opts, &block) attr = opts[:attr] ? opts[:attr].dup : {} 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 |