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,
|
||||
input[type=text],
|
||||
input[type=email],
|
||||
input[type=password]
|
||||
input[type=password],
|
||||
input[type=number]
|
||||
vertical-align: top
|
||||
font-family: 'Droid Sans', sans-serif
|
||||
font-size: 100%
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
<%= 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>
|
||||
</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>
|
||||
<%= ctx.makeCheckbox({text: 'Upscale small posts', id: 'upscale-small-posts', name: 'upscale-small-posts', checked: ctx.browsingSettings.upscaleSmallPosts}) %>
|
||||
</li>
|
||||
|
|
|
@ -29,7 +29,7 @@ class PostListController {
|
|||
requestPage: page => {
|
||||
return PostList.search(
|
||||
this._decorateSearchQuery(ctx.parameters.query),
|
||||
page, 40, fields);
|
||||
page, settings.get().postsPerPage, fields);
|
||||
},
|
||||
headerRenderer: headerCtx => {
|
||||
Object.assign(headerCtx, {
|
||||
|
|
|
@ -14,6 +14,7 @@ const defaultSettings = {
|
|||
transparencyGrid: true,
|
||||
fitMode: 'fit-both',
|
||||
tagSuggestions: true,
|
||||
postsPerPage: 40,
|
||||
};
|
||||
|
||||
class Settings extends events.EventTarget {
|
||||
|
|
|
@ -244,7 +244,7 @@ function makeCssName(text, suffix) {
|
|||
}
|
||||
|
||||
function escapeHtml(unsafe) {
|
||||
return unsafe
|
||||
return unsafe.toString()
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
|
|
|
@ -148,6 +148,11 @@ function makeColorInput(options) {
|
|||
'label', {class: 'color'}, colorInput + textInput);
|
||||
}
|
||||
|
||||
function makeNumericInput(options) {
|
||||
options.type = 'number';
|
||||
return makeInput(options);
|
||||
}
|
||||
|
||||
function getPostUrl(id, parameters) {
|
||||
let url = '/post/' + encodeURIComponent(id);
|
||||
if (parameters && parameters.query) {
|
||||
|
@ -344,6 +349,7 @@ function getTemplate(templatePath) {
|
|||
makeFlexboxAlign: makeFlexboxAlign,
|
||||
makeAccessKey: makeAccessKey,
|
||||
makeCssName: misc.makeCssName,
|
||||
makeNumericInput: makeNumericInput,
|
||||
});
|
||||
return htmlToDom(templateFactory(ctx));
|
||||
};
|
||||
|
|
|
@ -41,6 +41,8 @@ class SettingsView extends events.EventTarget {
|
|||
'#transparency-grid').checked,
|
||||
tagSuggestions: this._formNode.querySelector(
|
||||
'#tag-suggestions').checked,
|
||||
postsPerPage: this._formNode.querySelector(
|
||||
'#posts-per-page').value,
|
||||
},
|
||||
},
|
||||
}));
|
||||
|
|
Loading…
Reference in a new issue