Ghost/ghost/admin/app/validators/setting.js
Kevin Ansfield 4637c92797 🔥 remove Posts per Page setting (#583)
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
2017-03-14 18:09:06 +01:00

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();
}
}
});