client/general: refactor URL parameter handling

This commit is contained in:
rr-
2016-07-07 21:18:35 +02:00
parent cd1f4709f0
commit 5ac5eb5503
31 changed files with 132 additions and 127 deletions

View File

@ -14,11 +14,11 @@ class CommentsController {
topNavigation.activate('comments');
this._pageController = new PageController({
searchQuery: ctx.searchQuery,
parameters: ctx.parameters,
getClientUrlForPage: page => {
const searchQuery = Object.assign(
{}, ctx.searchQuery, {page: page});
return '/comments/' + misc.formatSearchQuery(searchQuery);
const parameters = Object.assign(
{}, ctx.parameters, {page: page});
return '/comments/' + misc.formatUrlParameters(parameters);
},
requestPage: page => {
return PostList.search(
@ -63,7 +63,7 @@ class CommentsController {
};
module.exports = router => {
router.enter('/comments/:query?',
(ctx, next) => { misc.parseSearchQueryRoute(ctx, next); },
router.enter('/comments/:parameters?',
(ctx, next) => { misc.parseUrlParametersRoute(ctx, next); },
(ctx, next) => { new CommentsController(ctx); });
};