Mass tag: don't show buttons if no tag specified

This commit is contained in:
Marcin Kurczewski 2013-11-21 20:58:53 +01:00
parent 1f2ce725ff
commit 601bdab8e1

View file

@ -1,5 +1,6 @@
<?php $classNames = ['post', 'post-type-' . TextHelper::camelCaseToHumanCase(PostType::toString($this->context->post->type))] ?>
<?php if (isset($this->context->source) and $this->context->source == 'mass-tag'): ?>
<?php $masstag = (isset($this->context->source) and $this->context->source == 'mass-tag' and !empty($this->context->additionalInfo)) ?>
<?php if ($masstag): ?>
<?php $classNames []= 'taggable' ?>
<?php if (in_array($this->context->additionalInfo, array_map(function($x) { return $x->name; }, $this->context->post->sharedTag))): ?>
<?php $classNames []= 'tagged' ?>
@ -7,7 +8,7 @@
<?php endif ?>
<div class="<?php echo implode(' ', $classNames) ?>">
<?php if (isset($this->context->source) and $this->context->source == 'mass-tag'): ?>
<?php if ($masstag): ?>
<a class="toggle-tag" href="<?php echo \Chibi\UrlHelper::route('post', 'toggle-tag', ['id' => $this->context->post->id, 'tag' => $this->context->additionalInfo]) ?>" data-text-tagged="Tagged" data-text-untagged="Untagged">
<?php echo in_array('tagged', $classNames) ? 'Tagged' : 'Untagged' ?>
</a>