Skip to content

Commit

Permalink
Add documentation to main js file
Browse files Browse the repository at this point in the history
  • Loading branch information
denniscdmc committed Jun 3, 2024
1 parent 4aa0e92 commit 580268d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions addon/components/form-field.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'],

Expand Down
2 changes: 1 addition & 1 deletion tests/dummy/config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down

0 comments on commit 580268d

Please sign in to comment.