Class: ActionBlocks::FormFieldBuilder
- Inherits:
-
BaseBuilder
- Object
- BaseBuilder
- ActionBlocks::FormFieldBuilder
- Defined in:
- lib/action_blocks/builders/form_builder.rb
Overview
Field
Instance Attribute Summary collapse
-
#form ⇒ Object
Returns the value of attribute form.
-
#name ⇒ Object
Returns the value of attribute name.
-
#section ⇒ Object
Returns the value of attribute section.
Attributes inherited from BaseBuilder
Instance Method Summary collapse
Methods inherited from BaseBuilder
#after_load, array_fields, block_type, builds, builds_many, delegate_class, #evaluate, #freeze, includes_scheme_helpers, #initialize, #is_block?, #key, references, sets, sets_many, #ui_reference, #valid?
Constructor Details
This class inherits a constructor from ActionBlocks::BaseBuilder
Instance Attribute Details
#form ⇒ Object
Returns the value of attribute form.
85 86 87 |
# File 'lib/action_blocks/builders/form_builder.rb', line 85 def form @form end |
#name ⇒ Object
Returns the value of attribute name.
85 86 87 |
# File 'lib/action_blocks/builders/form_builder.rb', line 85 def name @name end |
#section ⇒ Object
Returns the value of attribute section.
85 86 87 |
# File 'lib/action_blocks/builders/form_builder.rb', line 85 def section @section end |
Instance Method Details
#after_build(*args) ⇒ Object
101 102 103 |
# File 'lib/action_blocks/builders/form_builder.rb', line 101 def after_build(*args) @form.add_form_field(self) end |
#before_build(parent, *args) ⇒ Object
91 92 93 94 95 96 97 98 99 |
# File 'lib/action_blocks/builders/form_builder.rb', line 91 def before_build(parent, *args) @section = parent @form = @section.form @name = args[0] @field_key = "field-#{@form.model_id}-#{@name}" @width = parent.width @label = @name.to_s.titleize @label_above = false end |
#hashify(user) ⇒ Object
105 106 107 108 109 110 111 112 113 |
# File 'lib/action_blocks/builders/form_builder.rb', line 105 def hashify(user) { type: 'field', field_key: @field_key, label_above: @label_above, label: @label, width: @width, } end |