mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 03:44:29 +03:00
4637c92797
refs ##8131 - "posts per page" is now a theme-level concern - UI has already been removed, this finishes the cleanup by removing `settings.postsPerPage` and related validation/test support
33 lines
893 B
JavaScript
33 lines
893 B
JavaScript
import BaseValidator from './base';
|
|
|
|
export default BaseValidator.create({
|
|
properties: ['title', 'description', 'password'],
|
|
title(model) {
|
|
let title = model.get('title');
|
|
|
|
if (!validator.isLength(title, 0, 150)) {
|
|
model.get('errors').add('title', 'Title is too long');
|
|
this.invalidate();
|
|
}
|
|
},
|
|
|
|
description(model) {
|
|
let desc = model.get('description');
|
|
|
|
if (!validator.isLength(desc, 0, 200)) {
|
|
model.get('errors').add('description', 'Description is too long');
|
|
this.invalidate();
|
|
}
|
|
},
|
|
|
|
password(model) {
|
|
let isPrivate = model.get('isPrivate');
|
|
let password = model.get('password');
|
|
|
|
if (isPrivate && password === '') {
|
|
model.get('errors').add('password', 'Password must be supplied');
|
|
this.invalidate();
|
|
}
|
|
}
|
|
});
|