Class: Forme::InputsWrapper

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

Overview

Default inputs_wrapper used by the library, uses a fieldset.

Registered as :default.

Direct Known Subclasses

FieldSetOL

Defined Under Namespace

Classes: Div, FieldSetOL, OL, Table

Instance Method Summary collapse

Instance Method Details

#call(form, opts) ⇒ Object

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



1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
# File 'lib/forme.rb', line 1084

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