Class: Trestle::Form

Inherits:
Object
  • Object
show all
Extended by:
ActiveSupport::Autoload
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/collection_select.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.



13
14
15
# File 'lib/trestle/form.rb', line 13

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

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



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

def block
  @block
end

#optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

Instance Method Details

#dialog?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/trestle/form.rb', line 17

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

#render(template, instance) ⇒ Object



21
22
23
# File 'lib/trestle/form.rb', line 21

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