Post list errors are shown in nicer way
This commit is contained in:
parent
db8e13ec35
commit
4420fa588d
4 changed files with 21 additions and 5 deletions
|
@ -47,6 +47,7 @@ class PostController
|
||||||
$this->context->viewName = 'post-list-wrapper';
|
$this->context->viewName = 'post-list-wrapper';
|
||||||
$this->context->source = $source;
|
$this->context->source = $source;
|
||||||
$this->context->additionalInfo = $additionalInfo;
|
$this->context->additionalInfo = $additionalInfo;
|
||||||
|
$this->context->handleExceptions = true;
|
||||||
|
|
||||||
//redirect requests in form of /posts/?query=... to canonical address
|
//redirect requests in form of /posts/?query=... to canonical address
|
||||||
$formQuery = InputHelper::get('query');
|
$formQuery = InputHelper::get('query');
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
if (!isset($this->context->transport->paginator))
|
||||||
|
return;
|
||||||
|
|
||||||
$page = $this->context->transport->paginator->page;
|
$page = $this->context->transport->paginator->page;
|
||||||
$pageCount = $this->context->transport->paginator->pageCount;
|
$pageCount = $this->context->transport->paginator->pageCount;
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,19 @@
|
||||||
LayoutHelper::setSubTitle('posts');
|
LayoutHelper::setSubTitle('posts');
|
||||||
|
|
||||||
$tabs = [];
|
$tabs = [];
|
||||||
if (PrivilegesHelper::confirm(Privilege::ListPosts)) $tabs []= ['All posts', \Chibi\UrlHelper::route('post', 'list')];
|
if (PrivilegesHelper::confirm(Privilege::ListPosts))
|
||||||
if (PrivilegesHelper::confirm(Privilege::ListPosts)) $tabs []= ['Random', \Chibi\UrlHelper::route('post', 'random')];
|
$tabs []= ['All posts', \Chibi\UrlHelper::route('post', 'list')];
|
||||||
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 []= ['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;
|
$activeTab = 0;
|
||||||
if ($this->context->route->simpleActionName == 'random') $activeTab = 1;
|
if ($this->context->route->simpleActionName == 'random') $activeTab = 1;
|
||||||
|
|
|
@ -7,7 +7,10 @@ LayoutHelper::addScript('post-list.js');
|
||||||
<?php $this->renderFile('tag-mass-tag') ?>
|
<?php $this->renderFile('tag-mass-tag') ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?php if (empty($this->context->transport->posts)): ?>
|
|
||||||
|
<?php if (!empty($this->context->transport->message)): ?>
|
||||||
|
<?php $this->renderFile('message') ?>
|
||||||
|
<?php elseif (empty($this->context->transport->posts)): ?>
|
||||||
<p class="alert alert-warning">No posts to show.</p>
|
<p class="alert alert-warning">No posts to show.</p>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<div class="posts-wrapper">
|
<div class="posts-wrapper">
|
||||||
|
|
Loading…
Reference in a new issue