Class: FormForms::Elements::Fieldset

Inherits:
SubForm show all
Defined in:
lib/form_forms/elements/fieldset.rb

Instance Attribute Summary

Attributes inherited from BaseElement

#elements

Instance Method Summary collapse

Methods inherited from BaseElement

#delete

Constructor Details

#initialize(args = {}, &generator) ⇒ Fieldset

Returns a new instance of Fieldset.



4
5
6
7
8
9
# File 'lib/form_forms/elements/fieldset.rb', line 4

def initialize(args={}, &generator)
  self.legend nil
  self.args args

  super
end

Instance Method Details

#render(builder, view) ⇒ Object

Generate a fielset with a legend



15
16
17
18
19
20
21
22
23
# File 'lib/form_forms/elements/fieldset.rb', line 15

def render(builder, view)
  args = eval_property(:args, builder, view)
  legend = eval_property(:legend, builder, view)

  view.(:fieldset, args) do
    view.concat view.(:legend, legend) unless legend.nil?
    view.concat render_elements(builder, view)
  end
end