Ghost/core/client/validators/post.js
David Arvelo 6020702462 Add Validations Layer and Post Validations
closes #2893, issue #2850, issue #2856
- this is a stable, but quick and dirty validations layer for the time constraints
- this could be replaced with a unified server/client layer later. the infrastructure is there.
- create a validation engine mixin to match validators with models
- override the save method in the mixin to perform validations first
- create a post validator
- fixup calls to .save() to make sure they catch errors properly
2014-06-21 00:12:55 -04:00

18 lines
393 B
JavaScript

var PostValidator = Ember.Object.create({
validate: function (model) {
var validationErrors = [],
title = model.get('title');
if (validator.empty(title)) {
validationErrors.push({
message: 'You must specify a title for the post.'
});
}
return validationErrors;
}
});
export default PostValidator;