class Forme::InputsWrapper

  1. lib/forme/bs3.rb
  2. lib/forme/transformers/inputs_wrapper.rb
  3. show all
Superclass: Object

Default inputs_wrapper used by the library, uses a <fieldset>.

Registered as :default.

Methods

Public Instance

  1. call

Public Instance methods

call (form, opts, &block)

Wrap the inputs in a <fieldset>. If the :legend option is given, add a <legend> tag as the first child of the fieldset.

[show source]
   # File lib/forme/transformers/inputs_wrapper.rb
13 def call(form, opts, &block)
14   attr = opts[:attr] ? opts[:attr].dup : {}
15   Forme.attr_classes(attr, 'inputs')
16   if legend = opts[:legend]
17     form.tag(:fieldset, attr) do
18       form.emit(form.tag(:legend, opts[:legend_attr], legend))
19       yield
20     end
21   else
22     form.tag(:fieldset, attr, &block)
23   end
24 end