diff options
author | Mike Greiling <mike@pixelcog.com> | 2018-10-24 19:17:03 +0000 |
---|---|---|
committer | Tim Zallmann <tzallmann@gitlab.com> | 2018-10-24 19:17:03 +0000 |
commit | dfb082434611648658ace012d45b7d6914bc70bd (patch) | |
tree | 42c08de9e6a0420544253383473438fb12b367cc /app/assets/javascripts/gl_field_errors.js | |
parent | f8f1466ad07b3dcea7c0abc54fa25865b420b4f0 (diff) | |
download | gitlab-ce-dfb082434611648658ace012d45b7d6914bc70bd.tar.gz |
Prettify all the things (part 7)
Diffstat (limited to 'app/assets/javascripts/gl_field_errors.js')
-rw-r--r-- | app/assets/javascripts/gl_field_errors.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/app/assets/javascripts/gl_field_errors.js b/app/assets/javascripts/gl_field_errors.js index b9c51045b1d..3764e7ab422 100644 --- a/app/assets/javascripts/gl_field_errors.js +++ b/app/assets/javascripts/gl_field_errors.js @@ -16,9 +16,12 @@ export default class GlFieldErrors { initValidators() { // register selectors here as needed const validateSelectors = [':text', ':password', '[type=email]'] - .map(selector => `input${selector}`).join(','); + .map(selector => `input${selector}`) + .join(','); - this.state.inputs = this.form.find(validateSelectors).toArray() + this.state.inputs = this.form + .find(validateSelectors) + .toArray() .filter(input => !input.classList.contains(customValidationFlag)) .map(input => new GlFieldError({ input, formErrors: this })); @@ -42,7 +45,7 @@ export default class GlFieldErrors { /* Public method for triggering validity updates manually */ updateFormValidityState() { - this.state.inputs.forEach((field) => { + this.state.inputs.forEach(field => { if (field.state.submitted) { field.updateValidity(); } @@ -50,8 +53,9 @@ export default class GlFieldErrors { } focusOnFirstInvalid() { - const firstInvalid = this.state.inputs - .filter(input => !input.inputDomElement.validity.valid)[0]; + const firstInvalid = this.state.inputs.filter( + input => !input.inputDomElement.validity.valid, + )[0]; firstInvalid.inputElement.focus(); } } |