mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 15:12:58 +03:00
19 lines
427 B
JavaScript
19 lines
427 B
JavaScript
|
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');
|
||
|
}
|
||
|
});
|