This repository has been archived on 2025-02-26. You can view files and clone it, but cannot push or open issues or pull requests.
szurubooru/src/Views/post-small.phtml
Marcin Kurczewski 0a7fc387ac Simplified auth
2014-05-01 22:11:05 +02:00

78 lines
2 KiB
PHTML

<?php
Assets::addStylesheet('post-small.css');
$classNames =
[
'post',
'post-type-' . TextCaseConverter::convert(
TextHelper::resolveMimeType($this->context->post->mimeType)
?: PostType::toString($this->context->post->type),
TextCaseConverter::CAMEL_CASE,
TextCaseConverter::SPINAL_CASE),
];
$masstag = (isset($this->context->source)
and $this->context->source == 'mass-tag'
and !empty($this->context->additionalInfo));
if ($masstag)
{
$classNames []= 'taggable';
if ($this->context->post->isTaggedWith($this->context->additionalInfo))
{
$classNames []= 'tagged';
}
}
?>
<div class="<?= implode(' ', $classNames) ?>">
<?php if ($masstag): ?>
<a class="toggle-tag"
href="<?= \Chibi\Router::linkTo(['PostController', 'toggleTagAction'], [
'id' => $this->context->post->id,
'tag' => $this->context->additionalInfo,
'enable' => '_enable_']) ?>"
data-text-tagged="Tagged"
data-text-untagged="Untagged">
<?= in_array('tagged', $classNames) ? 'Tagged' : 'Untagged' ?>
</a>
<?php endif ?>
<a class="link"
<?php if (Auth::getCurrentUser()->hasEnabledPostTagTitles()): ?>
title="<?= TextHelper::reprTags($this->context->post->getTags()) ?>"
<?php endif ?>
href="<?= \Chibi\Router::linkTo(['PostController', 'viewAction'], ['id' => $this->context->post->id]) ?>">
<img
class="thumb"
src="<?= \Chibi\Router::linkTo(['PostController', 'thumbAction'], ['name' => $this->context->post->name]) ?>"
alt="@<?= $this->context->post->id ?>"/>
<?php
$x =
[
'score' => $this->context->post->score,
'comments' => $this->context->post->commentCount,
'favs' => $this->context->post->favCount,
];
?>
<?php if (!empty($x)): ?>
<div class="info-bar">
<?php foreach ($x as $key => $val): ?>
<?php if ($val == 0): ?>
<span class="inactive">
<?php else: ?>
<span>
<?php endif ?>
<i class="icon-<?= $key ?>"></i>
<?= $val ?>
</span>
<?php endforeach ?>
</div>
<?php endif ?>
</a>
</div>