Added "upvoted" tab

This commit is contained in:
Marcin Kurczewski 2014-03-03 21:56:10 +01:00
parent 2e3fdf98a0
commit d6f02fb724
2 changed files with 30 additions and 5 deletions

View file

@ -151,7 +151,15 @@ class PostController
$this->listAction('favmin:1', $page); $this->listAction('favmin:1', $page);
} }
/**
* @route /upvoted
* @route /upvoted/{page}
* @validate page \d*
*/
public function upvotedAction($page = 1)
{
$this->listAction('scoremin:1', $page);
}
/** /**
* @route /random * @route /random

View file

@ -2,24 +2,41 @@
CustomAssetViewDecorator::setSubTitle('posts'); CustomAssetViewDecorator::setSubTitle('posts');
$tabs = []; $tabs = [];
$activeTab = 0;
if (PrivilegesHelper::confirm(Privilege::ListPosts)) if (PrivilegesHelper::confirm(Privilege::ListPosts))
$tabs []= ['All posts', \Chibi\UrlHelper::route('post', 'list')]; $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 []= ['Random', \Chibi\UrlHelper::route('post', 'random')];
if ($this->context->route->simpleActionName == 'random')
$activeTab = count($tabs) - 1;
}
if (PrivilegesHelper::confirm(Privilege::ListPosts)) if (PrivilegesHelper::confirm(Privilege::ListPosts))
{
$tabs []= ['Favorites', \Chibi\UrlHelper::route('post', 'favorites')]; $tabs []= ['Favorites', \Chibi\UrlHelper::route('post', 'favorites')];
if ($this->context->route->simpleActionName == 'favorites')
$activeTab = count($tabs) - 1;
}
if (PrivilegesHelper::confirm(Privilege::ListPosts))
{
$tabs []= ['Upvoted', \Chibi\UrlHelper::route('post', 'upvoted')];
if ($this->context->route->simpleActionName == 'upvoted')
$activeTab = count($tabs) - 1;
}
if (PrivilegesHelper::confirm(Privilege::MassTag)) if (PrivilegesHelper::confirm(Privilege::MassTag))
{
$tabs []= ['Mass tag', \Chibi\UrlHelper::route('post', 'list', [ $tabs []= ['Mass tag', \Chibi\UrlHelper::route('post', 'list', [
'source' => 'mass-tag', 'source' => 'mass-tag',
'query' => isset($this->context->transport->searchQuery) ? htmlspecialchars($this->context->transport->searchQuery) : '', 'query' => isset($this->context->transport->searchQuery) ? htmlspecialchars($this->context->transport->searchQuery) : '',
'page' => isset($this->context->transport->paginator) ? $this->context->transport->paginator->page : 1])]; 'page' => isset($this->context->transport->paginator) ? $this->context->transport->paginator->page : 1])];
if ($this->context->source == 'mass-tag')
$activeTab = count($tabs) - 1;
}
$activeTab = 0;
if ($this->context->route->simpleActionName == 'random') $activeTab = 1;
if ($this->context->route->simpleActionName == 'favorites') $activeTab = 2;
if ($this->context->source == 'mass-tag') $activeTab = 3;
?> ?>
<nav class="tabs"> <nav class="tabs">