Class: Arara::Tags::TextField

Inherits:
ActionView::Helpers::Tags::Base
  • Object
show all
Includes:
ActionView::Helpers::Tags::Placeholderable
Defined in:
app/components/arara/tags/text_field.rb

Overview

:nodoc:

Direct Known Subclasses

PasswordField

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.field_typeObject



20
21
22
# File 'app/components/arara/tags/text_field.rb', line 20

def field_type
  @field_type ||= name.split("::").last.sub("Field", "").downcase
end

Instance Method Details

#renderObject



10
11
12
13
14
15
16
17
# File 'app/components/arara/tags/text_field.rb', line 10

def render
  options = @options.stringify_keys
  options["size"] = options["maxlength"] unless options.key?("size")
  options["type"] ||= field_type
  options["value"] = options.fetch("value") { value_before_type_cast } unless field_type == "file"
  add_default_name_and_id(options)
  @template_object.template.render(Arara::TextFieldComponent, options.symbolize_keys)
end