class ActionBlocks::FormFieldBuilder

Field

Attributes

form[RW]
name[RW]
section[RW]

Public Instance Methods

after_build(*args) click to toggle source
# File lib/action_blocks/builders/form_builder.rb, line 101
def after_build(*args)
  @form.add_form_field(self)
end
before_build(parent, *args) click to toggle source
# 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) click to toggle source
# 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