Class: Jquard::Schemas::Fields::TextInput

Inherits:
Field
  • Object
show all
Defined in:
lib/jquard/schemas/fields/text_input.rb

Constant Summary

Constants inherited from Field

Field::UNSET

Instance Attribute Summary

Attributes inherited from Field

#name

Instance Method Summary collapse

Methods inherited from Field

#column_span, #column_span_full, #default, #disabled, #disabled?, #helper_text, #initialize, #label, make, #placeholder, #required, #required?

Methods included from ComponentDispatch

#component_class

Constructor Details

This class inherits a constructor from Jquard::Schemas::Fields::Field

Instance Method Details

#email(value = true) ⇒ Object



5
6
7
8
# File 'lib/jquard/schemas/fields/text_input.rb', line 5

def email(value = true)
  @input_type = :email if value
  self
end

#input_typeObject



20
21
22
# File 'lib/jquard/schemas/fields/text_input.rb', line 20

def input_type
  @input_type || :text
end

#max_length(count = nil) ⇒ Object



24
25
26
27
28
29
# File 'lib/jquard/schemas/fields/text_input.rb', line 24

def max_length(count = nil)
  return @max_length if count.nil?

  @max_length = count
  self
end

#numeric(value = true) ⇒ Object



15
16
17
18
# File 'lib/jquard/schemas/fields/text_input.rb', line 15

def numeric(value = true)
  @input_type = :number if value
  self
end

#password(value = true) ⇒ Object



10
11
12
13
# File 'lib/jquard/schemas/fields/text_input.rb', line 10

def password(value = true)
  @input_type = :password if value
  self
end