allow to browse pages while keeping filter applied'

merge-requests/208/head
fatchan 5 years ago
parent 369aafa6ed
commit 3d2075e6e1
  1. 6
      gulp/res/css/style.css
  2. 5
      models/pages/boardlist.js
  3. 6
      views/includes/boardlistpages.pug
  4. 5
      views/pages/boardlist.pug

@ -28,6 +28,12 @@ main {
flex-direction: column; flex-direction: column;
} }
.flexcenter {
display: flex;
flex-direction: column;
align-items: center;
}
.strikethrough { .strikethrough {
text-decoration: line-through; text-decoration: line-through;
} }

@ -6,6 +6,10 @@ const { enableWebring } = require(__dirname+'/../../configs/main.json')
module.exports = async (req, res, next) => { module.exports = async (req, res, next) => {
const nopage = { ...req.query };
delete nopage.page;
const queryString = new URLSearchParams(nopage).toString();
let page; let page;
if (req.query.page && Number.isSafeInteger(parseInt(req.query.page))) { if (req.query.page && Number.isSafeInteger(parseInt(req.query.page))) {
page = parseInt(req.query.page); page = parseInt(req.query.page);
@ -67,6 +71,7 @@ module.exports = async (req, res, next) => {
maxPage, maxPage,
sort, sort,
search: !Array.isArray(search) ? search : null, search: !Array.isArray(search) ? search : null,
queryString,
}); });
} }

@ -1,9 +1,9 @@
| Page: | Page:
if maxPage === 0 if maxPage === 0
a.bold(href='?page=1') [1] a.bold(href=`?${queryString ? queryString+'&' : ''}page=1`) [1]
- for(let i = 1; i <= maxPage; i++) - for(let i = 1; i <= maxPage; i++)
if page === i if page === i
a.bold(href=`?page=${i}`) [#{i}] a.bold(href=`?${queryString ? queryString+'&' : ''}page=${i}`) [#{i}]
else else
a(href=`?page=${i}`) [#{i}] a(href=`?${queryString ? queryString+'&' : ''}page=${i}`) [#{i}]
| |

@ -6,8 +6,9 @@ block head
block content block content
h1.board-title Board List h1.board-title Board List
section.form-wrapper.flexleft.mv-10 section.flexcenter.mv-10
form.form-post(action=`/boards.html` method='GET') form.form-post(action=`/boards.html` method='GET')
input(type='hidden' value=page)
.row .row
.label Name .label Name
input(type='text' name='search' value=search) input(type='text' name='search' value=search)
@ -58,5 +59,5 @@ block content
td #{board.postsPerHour || '-'} td #{board.postsPerHour || '-'}
td #{board.uniqueUsers || '-'} td #{board.uniqueUsers || '-'}
td #{board.totalPosts || '-'} td #{board.totalPosts || '-'}
nav.pages.text-center.mt-5 nav.pages.text-center.mt-5.mv-0
include ../includes/boardlistpages.pug include ../includes/boardlistpages.pug

Loading…
Cancel
Save