From 7b955883c9393fd7f30ab75dc24d8b2810011c20 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Wed, 9 Oct 2013 12:24:25 +0200 Subject: [PATCH] Fixed issues with paging on /favorites --- src/Controllers/PostController.php | 8 +++++--- src/Views/post-list.phtml | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Controllers/PostController.php b/src/Controllers/PostController.php index cc51fbc6..dec30b95 100644 --- a/src/Controllers/PostController.php +++ b/src/Controllers/PostController.php @@ -18,7 +18,7 @@ class PostController * @validate page \d* * @validate query [^\/]* */ - public function listAction($page = 1, $query = null) + public function listAction($query = null, $page = 1) { $this->context->stylesheets []= 'post-list.css'; if ($this->config->browsing->endlessScrolling) @@ -311,10 +311,12 @@ class PostController /** * @route /favorites + * @route /favorites/{page} + * @validate page \d* */ - public function favoritesAction() + public function favoritesAction($page = 1) { - $this->listAction('favmin:1'); + $this->listAction('favmin:1', $page); $this->context->viewName = 'post-list'; } } diff --git a/src/Views/post-list.phtml b/src/Views/post-list.phtml index 66970ff9..51ce461e 100644 --- a/src/Views/post-list.phtml +++ b/src/Views/post-list.phtml @@ -18,6 +18,8 @@ if (!function_exists('pageUrl')) function pageUrl($page) { $context = \Chibi\Registry::getContext(); + $controller = $context->route->simpleControllerName; + $action = $context->route->simpleActionName; $page = max(1, $page); $page = min($context->transport->pageCount, $page); $params = []; @@ -26,7 +28,7 @@ if (!function_exists('pageUrl')) { $params['query'] = $context->transport->searchQuery; } - return \Chibi\UrlHelper::route('post', 'list', $params); + return \Chibi\UrlHelper::route($controller, $action, $params); } } ?>