Class: Forme::InputsWrapper::Table
- Inherits:
-
Object
- Object
- Forme::InputsWrapper::Table
- Defined in:
- lib/forme.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.
1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 |
# File 'lib/forme.rb', line 1235 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 |