Fixed issues with paging on /favorites

This commit is contained in:
Marcin Kurczewski 2013-10-09 12:24:25 +02:00
parent 1bbebfa640
commit 7b955883c9
2 changed files with 8 additions and 4 deletions

View file

@ -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';
}
}

View file

@ -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);
}
}
?>