Ghost/ghost/admin/app/validators/collection.js

19 lines
427 B
JavaScript
Raw Normal View History

import BaseValidator from './base';
import {isBlank} from '@ember/utils';
export default BaseValidator.create({
properties: ['title'],
name(model) {
let title = model.title;
let hasValidated = model.hasValidated;
if (isBlank(title)) {
model.errors.add('title', 'Please enter a title.');
this.invalidate();
}
hasValidated.addObject('title');
}
});