mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 19:33:02 +03:00
042aecb7f6
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)`
20 lines
608 B
JavaScript
20 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();
|
|
}
|
|
}
|
|
});
|