From 4420fa588d6b3a1f56924c77ec6511a5711e63e2 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Thu, 20 Feb 2014 19:06:06 +0100 Subject: [PATCH] Post list errors are shown in nicer way --- src/Controllers/PostController.php | 1 + src/Views/paginator.phtml | 3 +++ src/Views/post-list-wrapper.phtml | 17 +++++++++++++---- src/Views/post-list.phtml | 5 ++++- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/Controllers/PostController.php b/src/Controllers/PostController.php index 4980c2d9..93b7be2b 100644 --- a/src/Controllers/PostController.php +++ b/src/Controllers/PostController.php @@ -47,6 +47,7 @@ class PostController $this->context->viewName = 'post-list-wrapper'; $this->context->source = $source; $this->context->additionalInfo = $additionalInfo; + $this->context->handleExceptions = true; //redirect requests in form of /posts/?query=... to canonical address $formQuery = InputHelper::get('query'); diff --git a/src/Views/paginator.phtml b/src/Views/paginator.phtml index 28c935ba..2ac00a64 100644 --- a/src/Views/paginator.phtml +++ b/src/Views/paginator.phtml @@ -1,4 +1,7 @@ context->transport->paginator)) + return; + $page = $this->context->transport->paginator->page; $pageCount = $this->context->transport->paginator->pageCount; diff --git a/src/Views/post-list-wrapper.phtml b/src/Views/post-list-wrapper.phtml index 98080a5f..41f364b2 100644 --- a/src/Views/post-list-wrapper.phtml +++ b/src/Views/post-list-wrapper.phtml @@ -2,10 +2,19 @@ LayoutHelper::setSubTitle('posts'); $tabs = []; -if (PrivilegesHelper::confirm(Privilege::ListPosts)) $tabs []= ['All posts', \Chibi\UrlHelper::route('post', 'list')]; -if (PrivilegesHelper::confirm(Privilege::ListPosts)) $tabs []= ['Random', \Chibi\UrlHelper::route('post', 'random')]; -if (PrivilegesHelper::confirm(Privilege::ListPosts)) $tabs []= ['Favorites', \Chibi\UrlHelper::route('post', 'favorites')]; -if (PrivilegesHelper::confirm(Privilege::MassTag)) $tabs []= ['Mass tag', \Chibi\UrlHelper::route('post', 'list', ['query' => isset($this->context->transport->searchQuery) ? htmlspecialchars($this->context->transport->searchQuery) : '', 'source' => 'mass-tag', 'page' => $this->context->transport->paginator->page])]; +if (PrivilegesHelper::confirm(Privilege::ListPosts)) + $tabs []= ['All posts', \Chibi\UrlHelper::route('post', 'list')]; + +if (PrivilegesHelper::confirm(Privilege::ListPosts)) + $tabs []= ['Random', \Chibi\UrlHelper::route('post', 'random')]; +if (PrivilegesHelper::confirm(Privilege::ListPosts)) + $tabs []= ['Favorites', \Chibi\UrlHelper::route('post', 'favorites')]; + +if (PrivilegesHelper::confirm(Privilege::MassTag)) + $tabs []= ['Mass tag', \Chibi\UrlHelper::route('post', 'list', [ + 'source' => 'mass-tag', + 'query' => isset($this->context->transport->searchQuery) ? htmlspecialchars($this->context->transport->searchQuery) : '', + 'page' => isset($this->context->transport->paginator) ? $this->context->transport->paginator->page : 1])]; $activeTab = 0; if ($this->context->route->simpleActionName == 'random') $activeTab = 1; diff --git a/src/Views/post-list.phtml b/src/Views/post-list.phtml index 0394162b..06f1b9fd 100644 --- a/src/Views/post-list.phtml +++ b/src/Views/post-list.phtml @@ -7,7 +7,10 @@ LayoutHelper::addScript('post-list.js'); renderFile('tag-mass-tag') ?> -context->transport->posts)): ?> + +context->transport->message)): ?> + renderFile('message') ?> +context->transport->posts)): ?>

No posts to show.