class Forme::Wrapper::TableRow

Public Instance Methods

call(tag, input) click to toggle source

Wrap the input in tr and td tags.

Calls superclass method Forme::Wrapper#call
   # File lib/forme/transformers/wrapper.rb
33 def call(tag, input)
34   a = super.flatten
35   labels, other = a.partition{|e| e.is_a?(Tag) && e.type.to_s == 'label'}
36   if labels.length == 1
37     ltd = labels
38     rtd = other
39   else
40     ltd = a
41   end
42   input.tag(:tr, input.opts[:wrapper_attr], [input.tag(:td, {}, ltd), input.tag(:td, {}, rtd)])
43 end