Class: Rails::Angulate::Configuration
- Inherits:
-
Object
- Object
- Rails::Angulate::Configuration
- Defined in:
- lib/rails/angulate/configuration.rb
Instance Attribute Summary collapse
-
#default_error_classes ⇒ Object
Set on what conditions do you want the validation messages to show.
-
#validate_on ⇒ Object
Set on what conditions do you want the validation messages to show.
-
#validate_show_condition ⇒ Object
Set on what conditions do you want the validation messages to show.
- #validator_mappings ⇒ Object
Instance Method Summary collapse
- #add_mapper(name, mapper_class) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
14 15 16 17 18 |
# File 'lib/rails/angulate/configuration.rb', line 14 def initialize self.validate_on = { submit_attempt: :or, blur: nil } self.validate_show_condition = "%{field}.$invalid && (%{validate_on})" self.default_error_classes = [] end |
Instance Attribute Details
#default_error_classes ⇒ Object
Set on what conditions do you want the validation messages to show
Possible values: blur: only once the field has been visited dirty: only if the field is dirty submit_attempt: only once the user has submitted the form
12 13 14 |
# File 'lib/rails/angulate/configuration.rb', line 12 def default_error_classes @default_error_classes end |
#validate_on ⇒ Object
Set on what conditions do you want the validation messages to show
Possible values: blur: only once the field has been visited dirty: only if the field is dirty submit_attempt: only once the user has submitted the form
12 13 14 |
# File 'lib/rails/angulate/configuration.rb', line 12 def validate_on @validate_on end |
#validate_show_condition ⇒ Object
Set on what conditions do you want the validation messages to show
Possible values: blur: only once the field has been visited dirty: only if the field is dirty submit_attempt: only once the user has submitted the form
12 13 14 |
# File 'lib/rails/angulate/configuration.rb', line 12 def validate_show_condition @validate_show_condition end |
#validator_mappings ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/rails/angulate/configuration.rb', line 20 def validator_mappings @validator_mappings ||= { presence: 'required', format: 'pattern', length: 'maxlength' } end |
Instance Method Details
#add_mapper(name, mapper_class) ⇒ Object
28 29 30 |
# File 'lib/rails/angulate/configuration.rb', line 28 def add_mapper(name, mapper_class) Rails::Angulate::Mappers.register_mapper(name, mapper_class) end |