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

79 lines
2 KiB
PHTML
Raw Normal View History

<?php
2014-04-29 21:35:29 +02:00
Assets::addStylesheet('post-small.css');
$classNames =
[
'post',
2014-04-12 16:22:30 +02:00
'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';
}
}
?>
2014-04-27 14:44:06 +02:00
<div class="<?= implode(' ', $classNames) ?>">
<?php if ($masstag): ?>
2014-04-27 15:59:29 +02:00
<a class="toggle-tag"
2014-04-29 21:35:29 +02:00
href="<?= \Chibi\Router::linkTo(['PostController', 'toggleTagAction'], [
2014-04-27 15:59:29 +02:00
'id' => $this->context->post->id,
'tag' => $this->context->additionalInfo,
'enable' => '_enable_']) ?>"
data-text-tagged="Tagged"
data-text-untagged="Untagged">
2014-04-27 14:44:06 +02:00
<?= in_array('tagged', $classNames) ? 'Tagged' : 'Untagged' ?>
2014-04-27 15:59:29 +02:00
</a>
<?php endif ?>
2014-04-27 15:59:29 +02:00
<a class="link"
2014-05-01 16:12:37 +02:00
<?php if (Auth::getCurrentUser()->hasEnabledPostTagTitles()): ?>
2014-04-27 15:59:29 +02:00
title="<?= TextHelper::reprTags($this->context->post->getTags()) ?>"
<?php endif ?>
2014-04-29 21:35:29 +02:00
href="<?= \Chibi\Router::linkTo(['PostController', 'viewAction'], ['id' => $this->context->post->id]) ?>">
2014-04-27 15:59:29 +02:00
<img
class="thumb"
2014-04-29 21:35:29 +02:00
src="<?= \Chibi\Router::linkTo(['PostController', 'thumbAction'], ['name' => $this->context->post->name]) ?>"
2014-04-27 15:59:29 +02:00
alt="@<?= $this->context->post->id ?>"/>
2013-11-16 22:02:32 +01:00
<?php
$x =
[
'score' => $this->context->post->score,
'comments' => $this->context->post->commentCount,
'favs' => $this->context->post->favCount,
2013-11-16 22:02:32 +01:00
];
?>
2014-04-27 15:59:29 +02:00
2013-11-16 22:02:32 +01:00
<?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 ?>
2014-04-27 14:44:06 +02:00
<i class="icon-<?= $key ?>"></i>
2014-04-27 15:59:29 +02:00
<?= $val ?>
2013-11-16 22:02:32 +01:00
</span>
<?php endforeach ?>
</div>
<?php endif ?>
2013-10-19 20:05:03 +02:00
</a>
</div>