Tag list gets tabbed interface

This commit is contained in:
Marcin Kurczewski 2013-11-01 12:05:56 +01:00
parent ac506e8c95
commit be919603e3
4 changed files with 60 additions and 14 deletions

View file

@ -30,11 +30,11 @@
} }
form.aligned { form.aligned {
text-align: left; text-align: left;
margin: 2em auto; margin: 0 auto;
} }
form.aligned label.left { form.aligned label.left {
width: 7em; width: 7em;
} }
form h1 { form h1 {
text-align: center; display: none;
} }

View file

@ -7,7 +7,9 @@ class TagController
public function listAction() public function listAction()
{ {
$this->context->stylesheets []= 'tag-list.css'; $this->context->stylesheets []= 'tag-list.css';
$this->context->stylesheets []= 'tabs.css';
$this->context->subTitle = 'tags'; $this->context->subTitle = 'tags';
$this->context->viewName = 'tag-list-wrapper';
PrivilegesHelper::confirmWithException(Privilege::ListTags); PrivilegesHelper::confirmWithException(Privilege::ListTags);
$suppliedFilter = InputHelper::get('filter'); $suppliedFilter = InputHelper::get('filter');
@ -26,6 +28,11 @@ class TagController
*/ */
public function mergeAction() public function mergeAction()
{ {
$this->context->stylesheets []= 'tag-list.css';
$this->context->stylesheets []= 'tabs.css';
$this->context->subTitle = 'tags';
$this->context->viewName = 'tag-list-wrapper';
PrivilegesHelper::confirmWithException(Privilege::MergeTags); PrivilegesHelper::confirmWithException(Privilege::MergeTags);
if (InputHelper::get('submit')) if (InputHelper::get('submit'))
{ {
@ -61,6 +68,11 @@ class TagController
*/ */
public function renameAction() public function renameAction()
{ {
$this->context->stylesheets []= 'tag-list.css';
$this->context->stylesheets []= 'tabs.css';
$this->context->subTitle = 'tags';
$this->context->viewName = 'tag-list-wrapper';
PrivilegesHelper::confirmWithException(Privilege::MergeTags); PrivilegesHelper::confirmWithException(Privilege::MergeTags);
if (InputHelper::get('submit')) if (InputHelper::get('submit'))
{ {
@ -84,6 +96,11 @@ class TagController
*/ */
public function massTagRedirectAction() public function massTagRedirectAction()
{ {
$this->context->stylesheets []= 'tag-list.css';
$this->context->stylesheets []= 'tabs.css';
$this->context->subTitle = 'tags';
$this->context->viewName = 'tag-list-wrapper';
PrivilegesHelper::confirmWithException(Privilege::MassTag); PrivilegesHelper::confirmWithException(Privilege::MassTag);
if (InputHelper::get('submit')) if (InputHelper::get('submit'))
{ {

View file

@ -0,0 +1,41 @@
<?php $tabs = [] ?>
<?php if (PrivilegesHelper::confirm(Privilege::ListTags)) $tabs['list'] = 'List'; ?>
<?php if (PrivilegesHelper::confirm(Privilege::RenameTags)) $tabs['rename'] = 'Rename'; ?>
<?php if (PrivilegesHelper::confirm(Privilege::MergeTags)) $tabs['merge'] = 'Merge'; ?>
<?php if (PrivilegesHelper::confirm(Privilege::MassTag)) $tabs['mass-tag-redirect'] = 'Mass tag'; ?>
<?php if (count(array_diff($tabs, ['list'])) > 1): ?>
<div class="tabs">
<nav>
<ul>
<?php foreach ($tabs as $tab => $name): ?>
<?php if ($this->context->route->simpleActionName == $tab): ?>
<li class="selected <?php echo $tab ?>">
<?php else: ?>
<li class="<?php echo $tab ?>">
<?php endif ?>
<a href="<?php echo \Chibi\UrlHelper::route('tag', $tab) ?>">
<?php echo $name ?>
</a>
</li>
<?php endforeach ?>
</ul>
</nav>
</div>
<?php endif ?>
<?php if ($this->context->route->simpleActionName == 'merge'): ?>
<?php $this->renderFile('tag-merge') ?>
<?php endif ?>
<?php if ($this->context->route->simpleActionName == 'rename'): ?>
<?php $this->renderFile('tag-rename') ?>
<?php endif ?>
<?php if ($this->context->route->simpleActionName == 'list'): ?>
<?php $this->renderFile('tag-list') ?>
<?php endif ?>
<?php if ($this->context->route->simpleActionName == 'mass-tag-redirect'): ?>
<?php $this->renderFile('tag-mass-tag') ?>
<?php endif ?>

View file

@ -15,15 +15,3 @@
<?php endforeach ?> <?php endforeach ?>
</ul> </ul>
</div> </div>
<?php if (PrivilegesHelper::confirm(Privilege::MergeTags)): ?>
<?php $this->renderFile('tag-merge') ?>
<?php endif ?>
<?php if (PrivilegesHelper::confirm(Privilege::RenameTags)): ?>
<?php $this->renderFile('tag-rename') ?>
<?php endif ?>
<?php if (PrivilegesHelper::confirm(Privilege::MassTag)): ?>
<?php $this->renderFile('tag-mass-tag') ?>
<?php endif ?>