mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-20 09:22:49 +03:00
090c58edb5
fixes #4087 - Adds correct validations for meta_title/meta_description - Adds correct coloring of letter count
29 lines
796 B
JavaScript
29 lines
796 B
JavaScript
var PostValidator = Ember.Object.create({
|
|
check: function (model) {
|
|
var validationErrors = [],
|
|
data = model.getProperties('title', 'meta_title', 'meta_description');
|
|
|
|
if (validator.empty(data.title)) {
|
|
validationErrors.push({
|
|
message: 'You must specify a title for the post.'
|
|
});
|
|
}
|
|
|
|
if (!validator.isLength(data.meta_title, 0, 70)) {
|
|
validationErrors.push({
|
|
message: 'Meta Title is too long.'
|
|
});
|
|
}
|
|
|
|
if (!validator.isLength(data.meta_description, 0, 156)) {
|
|
validationErrors.push({
|
|
message: 'Meta Description is too long.'
|
|
});
|
|
}
|
|
|
|
return validationErrors;
|
|
}
|
|
});
|
|
|
|
export default PostValidator;
|