1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00
Ghost-Admin/app/validators/integration.js
Kevin Ansfield 37a23122c2 Switch from embor-browserify to ember-auto-import
no issue
- minor reduction in build size. Before/after:
  - `vendor.min.js 3.32 MB (710.66 KB gzipped)`
  - `vendor.min.js 3.29 MB (706 KB gzipped)`
2019-01-22 13:09:38 +00:00

19 lines
608 B
JavaScript

import BaseValidator from './base';
import validator from 'validator';
import {isBlank} from '@ember/utils';
export default BaseValidator.create({
properties: ['name'],
name(model) {
if (isBlank(model.name)) {
model.errors.add('name', 'Please enter a name');
model.hasValidated.pushObject('name');
this.invalidate();
} else if (!validator.isLength(model.name, 0, 191)) {
model.errors.add('name', 'Name is too long, max 191 chars');
model.hasValidated.pushObject('name');
this.invalidate();
}
}
});