Class: Trestle::Form
- Inherits:
-
Object
- Object
- Trestle::Form
- 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/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
Defined Under Namespace
Modules: Fields Classes: Automatic, Builder, Field, Renderer
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #dialog? ⇒ Boolean
-
#initialize(options = {}, &block) ⇒ Form
constructor
A new instance of Form.
- #modal? ⇒ Boolean
- #render(template, instance) ⇒ Object
Constructor Details
#initialize(options = {}, &block) ⇒ Form
Returns a new instance of Form.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/trestle/form.rb', line 11 def initialize(={}, &block) @options, @block = , block if @options[:modal] == true @options[:modal] = {} end if [:dialog] Trestle.deprecator.warn("`form dialog: true` is deprecated. Please use `form modal: true` instead.", caller_locations(3)) @options.delete(:dialog) @options[:modal] = {} end end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
9 10 11 |
# File 'lib/trestle/form.rb', line 9 def block @block end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/trestle/form.rb', line 9 def @options end |
Instance Method Details
#dialog? ⇒ Boolean
29 30 31 32 |
# File 'lib/trestle/form.rb', line 29 def dialog? Trestle.deprecator.warn("`Trestle::Form#dialog?` is deprecated. Please use `modal?` instead.") [:modal] end |
#modal? ⇒ Boolean
25 26 27 |
# File 'lib/trestle/form.rb', line 25 def modal? [:modal] end |
#render(template, instance) ⇒ Object
34 35 36 |
# File 'lib/trestle/form.rb', line 34 def render(template, instance) Renderer.new(template).render_form(instance, &block) end |