Class: Railsboot::FormField::EmailFieldComponent

Inherits:
FieldComponent
  • Object
show all
Defined in:
app/components/railsboot/form_field/email_field_component.rb

Instance Method Summary collapse

Constructor Details

#initialize(form:, name:, size: DEFAULT_SIZE, **html_attributes) ⇒ EmailFieldComponent

Returns a new instance of EmailFieldComponent.



2
3
4
5
6
7
8
9
10
11
12
13
# File 'app/components/railsboot/form_field/email_field_component.rb', line 2

def initialize(form:, name:, size: DEFAULT_SIZE, **html_attributes)
  @form = form
  @name = name
  @size = fetch_or_fallback(size, SIZES, DEFAULT_SIZE)
  @html_attributes = html_attributes

  @html_attributes[:class] = class_names(
    "form-control",
    {"form-control-#{@size}" => @size.present?},
    html_attributes[:class]
  )
end

Instance Method Details

#callObject



15
16
17
# File 'app/components/railsboot/form_field/email_field_component.rb', line 15

def call
  @form.email_field @name, **@html_attributes
end