From f2947a2550067a601e0d2da36a122f3ba79d16f9 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Mon, 21 Oct 2013 13:13:10 +0200 Subject: [PATCH] Added "random" tab --- src/Controllers/PostController.php | 13 +++++++++++++ src/Views/layout-normal.phtml | 3 +++ 2 files changed, 16 insertions(+) diff --git a/src/Controllers/PostController.php b/src/Controllers/PostController.php index e006c5c1..ea0bda07 100644 --- a/src/Controllers/PostController.php +++ b/src/Controllers/PostController.php @@ -178,6 +178,19 @@ class PostController + /** + * @route /random + * @route /random/{page} + * @validate page \d* + */ + public function randomAction($page = 1) + { + $this->listAction('order:random', $page); + $this->context->viewName = 'post-list'; + } + + + /** * @route /post/upload */ diff --git a/src/Views/layout-normal.phtml b/src/Views/layout-normal.phtml index b4a2b8f5..10575411 100644 --- a/src/Views/layout-normal.phtml +++ b/src/Views/layout-normal.phtml @@ -27,6 +27,9 @@ if (PrivilegesHelper::confirm(Privilege::ListPosts)) $nav []= ['Browse', \Chibi\UrlHelper::route('post', 'list')]; + if (PrivilegesHelper::confirm(Privilege::ListPosts)) + $nav []= ['Random', \Chibi\UrlHelper::route('post', 'random')]; + if (PrivilegesHelper::confirm(Privilege::ListPosts)) $nav []= ['Favorites', \Chibi\UrlHelper::route('post', 'favorites')];