client/settings: add posts per page option
This commit is contained in:
parent
9383fd2b27
commit
9304e309f6
7 changed files with 16 additions and 3 deletions
|
@ -137,7 +137,8 @@ select,
|
||||||
textarea,
|
textarea,
|
||||||
input[type=text],
|
input[type=text],
|
||||||
input[type=email],
|
input[type=email],
|
||||||
input[type=password]
|
input[type=password],
|
||||||
|
input[type=number]
|
||||||
vertical-align: top
|
vertical-align: top
|
||||||
font-family: 'Droid Sans', sans-serif
|
font-family: 'Droid Sans', sans-serif
|
||||||
font-size: 100%
|
font-size: 100%
|
||||||
|
|
|
@ -8,6 +8,9 @@
|
||||||
<%= ctx.makeCheckbox({text: 'Enable keyboard shortcuts', id: 'keyboard-shortcuts', name: 'keyboard-shortcuts', checked: ctx.browsingSettings.keyboardShortcuts}) %>
|
<%= ctx.makeCheckbox({text: 'Enable keyboard shortcuts', id: 'keyboard-shortcuts', name: 'keyboard-shortcuts', checked: ctx.browsingSettings.keyboardShortcuts}) %>
|
||||||
<a class='append icon' href='/help/keyboard'><i class='fa fa-question-circle-o'></i></a>
|
<a class='append icon' href='/help/keyboard'><i class='fa fa-question-circle-o'></i></a>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<%= ctx.makeNumericInput({text: 'Number of posts per page', id: 'posts-per-page', name: 'posts-per-page', checked: ctx.browsingSettings.postCount, min: 10, max: 100, value: ctx.browsingSettings.postsPerPage}) %>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<%= ctx.makeCheckbox({text: 'Upscale small posts', id: 'upscale-small-posts', name: 'upscale-small-posts', checked: ctx.browsingSettings.upscaleSmallPosts}) %>
|
<%= ctx.makeCheckbox({text: 'Upscale small posts', id: 'upscale-small-posts', name: 'upscale-small-posts', checked: ctx.browsingSettings.upscaleSmallPosts}) %>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -29,7 +29,7 @@ class PostListController {
|
||||||
requestPage: page => {
|
requestPage: page => {
|
||||||
return PostList.search(
|
return PostList.search(
|
||||||
this._decorateSearchQuery(ctx.parameters.query),
|
this._decorateSearchQuery(ctx.parameters.query),
|
||||||
page, 40, fields);
|
page, settings.get().postsPerPage, fields);
|
||||||
},
|
},
|
||||||
headerRenderer: headerCtx => {
|
headerRenderer: headerCtx => {
|
||||||
Object.assign(headerCtx, {
|
Object.assign(headerCtx, {
|
||||||
|
|
|
@ -14,6 +14,7 @@ const defaultSettings = {
|
||||||
transparencyGrid: true,
|
transparencyGrid: true,
|
||||||
fitMode: 'fit-both',
|
fitMode: 'fit-both',
|
||||||
tagSuggestions: true,
|
tagSuggestions: true,
|
||||||
|
postsPerPage: 40,
|
||||||
};
|
};
|
||||||
|
|
||||||
class Settings extends events.EventTarget {
|
class Settings extends events.EventTarget {
|
||||||
|
|
|
@ -244,7 +244,7 @@ function makeCssName(text, suffix) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function escapeHtml(unsafe) {
|
function escapeHtml(unsafe) {
|
||||||
return unsafe
|
return unsafe.toString()
|
||||||
.replace(/&/g, '&')
|
.replace(/&/g, '&')
|
||||||
.replace(/</g, '<')
|
.replace(/</g, '<')
|
||||||
.replace(/>/g, '>')
|
.replace(/>/g, '>')
|
||||||
|
|
|
@ -148,6 +148,11 @@ function makeColorInput(options) {
|
||||||
'label', {class: 'color'}, colorInput + textInput);
|
'label', {class: 'color'}, colorInput + textInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function makeNumericInput(options) {
|
||||||
|
options.type = 'number';
|
||||||
|
return makeInput(options);
|
||||||
|
}
|
||||||
|
|
||||||
function getPostUrl(id, parameters) {
|
function getPostUrl(id, parameters) {
|
||||||
let url = '/post/' + encodeURIComponent(id);
|
let url = '/post/' + encodeURIComponent(id);
|
||||||
if (parameters && parameters.query) {
|
if (parameters && parameters.query) {
|
||||||
|
@ -344,6 +349,7 @@ function getTemplate(templatePath) {
|
||||||
makeFlexboxAlign: makeFlexboxAlign,
|
makeFlexboxAlign: makeFlexboxAlign,
|
||||||
makeAccessKey: makeAccessKey,
|
makeAccessKey: makeAccessKey,
|
||||||
makeCssName: misc.makeCssName,
|
makeCssName: misc.makeCssName,
|
||||||
|
makeNumericInput: makeNumericInput,
|
||||||
});
|
});
|
||||||
return htmlToDom(templateFactory(ctx));
|
return htmlToDom(templateFactory(ctx));
|
||||||
};
|
};
|
||||||
|
|
|
@ -41,6 +41,8 @@ class SettingsView extends events.EventTarget {
|
||||||
'#transparency-grid').checked,
|
'#transparency-grid').checked,
|
||||||
tagSuggestions: this._formNode.querySelector(
|
tagSuggestions: this._formNode.querySelector(
|
||||||
'#tag-suggestions').checked,
|
'#tag-suggestions').checked,
|
||||||
|
postsPerPage: this._formNode.querySelector(
|
||||||
|
'#posts-per-page').value,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
Loading…
Reference in a new issue