Class: Forme::InputsWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/forme/transformers/inputs_wrapper.rb

Overview

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

Registered as :default.

Direct Known Subclasses

FieldSetOL

Defined Under Namespace

Classes: Bootstrap3, Bs3Table, Div, FieldSetOL, OL, TR, Table

Instance Method Summary collapse

Instance Method Details

#call(form, opts, &block) ⇒ Object

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


13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/forme/transformers/inputs_wrapper.rb', line 13

def call(form, opts, &block)
  attr = opts[:attr] ? opts[:attr].dup : {}
  Forme.attr_classes(attr, 'inputs')
  if legend = opts[:legend]
    form.tag(:fieldset, attr) do
      form.emit(form.tag(:legend, opts[:legend_attr], legend))
      yield
    end
  else
    form.tag(:fieldset, attr, &block)
  end
end