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)

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, line 13
def call(form, opts)
  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, &Proc.new)
  end
end