diff --git a/addon/components/form-field.js b/addon/components/form-field.js index a7c3533..cf5e1ac 100644 --- a/addon/components/form-field.js +++ b/addon/components/form-field.js @@ -3,6 +3,17 @@ import { isPresent } from '@ember/utils'; import { computed } from '@ember/object'; import Component from '@ember/component'; +// +// A generic wrapper around a form element (input, select, radios) +// +// By providing this component with an attribute name on a model, this component will auto-detect any validation errors (from DS.Errors) +// on the specified attribute, and apply appropriate error classes and error messages to the field. +// +// This component also support custom errors that is not part of the model (client-side validations, for example). +// Although comprehensive client-side validation libraries are available, we do not currently need the full capability of those libraries and a simple custom error string will do. +// +// This component is a modified and simplified version of https://alexspeller.com/server-side-validations-with-ember-data-and-ds-errors/ +// export default Component.extend({ classNameBindings: [':form-group', 'hasError:has-error'], diff --git a/tests/dummy/config/environment.js b/tests/dummy/config/environment.js index 3b32e1f..4293266 100644 --- a/tests/dummy/config/environment.js +++ b/tests/dummy/config/environment.js @@ -17,7 +17,7 @@ module.exports = function (environment) { APP: { // Here you can pass flags/options to your application instance // when it is created - }, + } }; if (environment === 'development') {