szurubooru/src/Views/comment-list.phtml

44 lines
1.4 KiB
PHTML
Raw Normal View History

<?php
LayoutHelper::setSubTitle('comments');
?>
<?php if (empty($this->context->transport->posts)): ?>
<p class="alert alert-warning">No comments to show.</p>
<?php else: ?>
<?php
LayoutHelper::addStylesheet('comment-list.css');
LayoutHelper::addStylesheet('comment-small.css');
LayoutHelper::addStylesheet('comment-edit.css');
LayoutHelper::addScript('comment-edit.js');
?>
<div class="comments-wrapper">
<div class="comments paginator-content">
<?php foreach ($this->context->transport->posts as $post): ?>
<div class="comment-group">
<div class="post-wrapper">
<?php $this->context->post = $post ?>
<?php echo $this->renderFile('post-small') ?>
</div>
<div class="comments">
<?php $comments = array_reverse($post->getComments()) ?>
<?php foreach (array_slice($comments, 0, $this->config->comments->maxCommentsInList) as $comment): ?>
<?php $this->context->comment = $comment ?>
<?php echo $this->renderFile('comment-small') ?>
<?php endforeach ?>
<?php if (count($comments) > $this->config->comments->maxCommentsInList): ?>
<a href="<?php echo \Chibi\UrlHelper::route('post', 'view', ['id' => $this->context->post->id]) ?>">
<span class="hellip">(more&hellip;)</span>
</a>
<?php endif ?>
</div>
<div class="clear"></div>
</div>
<?php endforeach ?>
</div>
<?php $this->renderFile('paginator') ?>
</div>
<?php endif ?>