Class: Trestle::Form

Inherits:
Object
  • Object
show all
Defined in:
lib/trestle/form.rb,
lib/trestle/form/field.rb,
lib/trestle/form/fields.rb,
lib/trestle/form/builder.rb,
lib/trestle/form/renderer.rb,
lib/trestle/form/automatic.rb,
lib/trestle/form/fields/select.rb,
lib/trestle/form/fields/check_box.rb,
lib/trestle/form/fields/file_field.rb,
lib/trestle/form/fields/form_group.rb,
lib/trestle/form/fields/tag_select.rb,
lib/trestle/form/fields/date_select.rb,
lib/trestle/form/fields/range_field.rb,
lib/trestle/form/fields/time_select.rb,
lib/trestle/form/fields/form_control.rb,
lib/trestle/form/fields/radio_button.rb,
lib/trestle/form/fields/static_field.rb,
lib/trestle/form/fields/datetime_select.rb,
lib/trestle/form/fields/time_zone_select.rb,
lib/trestle/form/fields/check_box_helpers.rb,
lib/trestle/form/fields/collection_select.rb,
lib/trestle/form/fields/radio_button_helpers.rb,
lib/trestle/form/fields/collection_check_boxes.rb,
lib/trestle/form/fields/collection_radio_buttons.rb,
lib/trestle/form/fields/grouped_collection_select.rb

Direct Known Subclasses

Automatic

Defined Under Namespace

Modules: Fields Classes: Automatic, Builder, Field, Renderer

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}, &block) ⇒ Form

Returns a new instance of Form.


11
12
13
# File 'lib/trestle/form.rb', line 11

def initialize(options={}, &block)
  @options, @block = options, block
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block


9
10
11
# File 'lib/trestle/form.rb', line 9

def block
  @block
end

#optionsObject (readonly)

Returns the value of attribute options


9
10
11
# File 'lib/trestle/form.rb', line 9

def options
  @options
end

Instance Method Details

#dialog?Boolean

Returns:

  • (Boolean)

15
16
17
# File 'lib/trestle/form.rb', line 15

def dialog?
  options[:dialog] == true
end

#render(template, instance) ⇒ Object


19
20
21
# File 'lib/trestle/form.rb', line 19

def render(template, instance)
  Renderer.new(template).render_form(instance, &block)
end