Class: Neewom::AbstractField

Inherits:
Object
  • Object
show all
Defined in:
lib/neewom/abstract_field.rb

Constant Summary collapse

SUPPORTED_FIELDS =

This constant can be changed OUTSIDE !!!

[
  # 'check_box_collection',
  EMAIL               = 'email_field',
  HIDDEN              = 'hidden_field',
  NUMBER              = 'number_field',
  PASSWORD            = 'password_field',
  PHONE               = 'phone_field',
  # 'radio_button_collection',
  SELECT              = 'select_field',
  MULTIPLE_SELECT     = 'multiple_select_field',
  SUBMIT              = 'submit',
  TEXTAREA            = 'text_area',
  TEXT                = 'text_field',
  CHECKBOX            = 'checkbox',
  FILE                = 'file',
  DATEPICKER          = 'datepicker',
  TIMEPICKER          = 'timepicker',
  DATETIMEPICKER      = 'datetimepicker'
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#collectionObject

Returns the value of attribute collection.



24
25
26
# File 'lib/neewom/abstract_field.rb', line 24

def collection
  @collection
end

#collection_klassObject

Returns the value of attribute collection_klass.



24
25
26
# File 'lib/neewom/abstract_field.rb', line 24

def collection_klass
  @collection_klass
end

#collection_methodObject

Returns the value of attribute collection_method.



24
25
26
# File 'lib/neewom/abstract_field.rb', line 24

def collection_method
  @collection_method
end

#collection_paramsObject

Returns the value of attribute collection_params.



24
25
26
# File 'lib/neewom/abstract_field.rb', line 24

def collection_params
  @collection_params
end

#custom_optionsObject

Returns the value of attribute custom_options.



24
25
26
# File 'lib/neewom/abstract_field.rb', line 24

def custom_options
  @custom_options
end

#inputObject

Returns the value of attribute input.



24
25
26
# File 'lib/neewom/abstract_field.rb', line 24

def input
  @input
end

#input_htmlObject

Returns the value of attribute input_html.



24
25
26
# File 'lib/neewom/abstract_field.rb', line 24

def input_html
  @input_html
end

#labelObject

Returns the value of attribute label.



24
25
26
# File 'lib/neewom/abstract_field.rb', line 24

def label
  @label
end

#label_methodObject

Returns the value of attribute label_method.



24
25
26
# File 'lib/neewom/abstract_field.rb', line 24

def label_method
  @label_method
end

#nameObject

Returns the value of attribute name.



24
25
26
# File 'lib/neewom/abstract_field.rb', line 24

def name
  @name
end

#validationsObject

Returns the value of attribute validations.



24
25
26
# File 'lib/neewom/abstract_field.rb', line 24

def validations
  @validations
end

#value_methodObject

Returns the value of attribute value_method.



24
25
26
# File 'lib/neewom/abstract_field.rb', line 24

def value_method
  @value_method
end

#virtualObject

Returns the value of attribute virtual.



24
25
26
# File 'lib/neewom/abstract_field.rb', line 24

def virtual
  @virtual
end

Instance Method Details

#build_collection(bind) ⇒ Object



68
69
70
71
72
# File 'lib/neewom/abstract_field.rb', line 68

def build_collection(bind)
  return collection if collection.present?

  Neewom::Collection.build_for_field(self, bind)
end

#build_validationsObject



56
57
58
# File 'lib/neewom/abstract_field.rb', line 56

def build_validations
  validations
end

#submit?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/neewom/abstract_field.rb', line 28

def submit?
  input == SUBMIT
end