mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-23 19:02:29 +03:00
af47f88648
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
16 lines
309 B
JavaScript
16 lines
309 B
JavaScript
function init() {
|
|
// Provide a few custom validators
|
|
//
|
|
validator.extend('empty', function (str) {
|
|
return Ember.isBlank(str);
|
|
});
|
|
|
|
validator.extend('notContains', function (str, badString) {
|
|
return !_.contains(str, badString);
|
|
});
|
|
}
|
|
|
|
export default {
|
|
init: init
|
|
};
|