1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00

🔥 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
This commit is contained in:
Kevin Ansfield 2017-03-14 17:09:06 +00:00 committed by Katharina Irrgang
parent 7661212b1b
commit 0e16bd61b8
4 changed files with 2 additions and 37 deletions

View file

@ -12,7 +12,6 @@ export default Model.extend(ValidationEngine, {
cover: attr('string'),
icon: attr('string'),
defaultLang: attr('string'),
postsPerPage: attr('number'),
forceI18n: attr('boolean'),
permalinks: attr('string'),
activeTimezone: attr('string', {defaultValue: 'Etc/UTC'}),

View file

@ -1,7 +1,7 @@
import BaseValidator from './base';
export default BaseValidator.create({
properties: ['title', 'description', 'password', 'postsPerPage'],
properties: ['title', 'description', 'password'],
title(model) {
let title = model.get('title');
@ -28,20 +28,5 @@ export default BaseValidator.create({
model.get('errors').add('password', 'Password must be supplied');
this.invalidate();
}
},
postsPerPage(model) {
let postsPerPage = model.get('postsPerPage');
if (!validator.isInt(postsPerPage)) {
model.get('errors').add('postsPerPage', 'Posts per page must be a number');
this.invalidate();
} else if (postsPerPage > 1000) {
model.get('errors').add('postsPerPage', 'The maximum number of posts per page is 1000');
this.invalidate();
} else if (postsPerPage < 1) {
model.get('errors').add('postsPerPage', 'The minimum number of posts per page is 1');
this.invalidate();
}
}
});

View file

@ -50,16 +50,6 @@ export default [
updated_at: '2015-10-27T17:39:58.278Z',
updated_by: 1
},
{
id: 6,
created_at: '2015-09-11T09:44:30.809Z',
created_by: 1,
key: 'postsPerPage',
type: 'blog',
updated_at: '2015-10-04T16:26:05.211Z',
updated_by: 1,
value: '5'
},
{
id: 7,
key: 'forceI18n',

View file

@ -8,7 +8,7 @@ import run from 'ember-runloop';
const {Error: EmberError} = Ember;
function stubSettings(server, labs, validSave = true, validSettings = true) {
function stubSettings(server, labs, validSave = true) {
let settings = [
{
id: '1',
@ -18,15 +18,6 @@ function stubSettings(server, labs, validSave = true, validSettings = true) {
}
];
if (validSettings) {
settings.push({
id: '2',
type: 'blog',
key: 'postsPerPage',
value: 1
});
}
server.get('/ghost/api/v0.1/settings/', function () {
return [200, {'Content-Type': 'application/json'}, JSON.stringify({settings})];
});