szurubooru/src/Views/comment-list.phtml

47 lines
1.5 KiB
PHTML
Raw Normal View History

<?php
2014-02-27 15:04:36 +01:00
CustomAssetViewDecorator::setSubTitle('comments');
?>
<?php if (empty($this->context->transport->posts)): ?>
<p class="alert alert-warning">No comments to show.</p>
<?php else: ?>
<?php
2014-02-27 15:04:36 +01:00
CustomAssetViewDecorator::addStylesheet('comment-list.css');
CustomAssetViewDecorator::addStylesheet('comment-small.css');
CustomAssetViewDecorator::addStylesheet('comment-edit.css');
CustomAssetViewDecorator::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">
2014-04-27 15:59:29 +02:00
<?php
$this->context->post = $post;
$comments = array_reverse($post->getComments());
$commentsToDisplay = array_slice($comments, 0, $this->config->comments->maxCommentsInList);
?>
2014-04-27 14:44:06 +02:00
<?= $this->renderFile('post-small') ?>
</div>
<div class="comments">
2014-04-27 15:59:29 +02:00
<?php foreach ($commentsToDisplay as $comment): ?>
<?php $this->context->comment = $comment ?>
2014-04-27 14:44:06 +02:00
<?= $this->renderFile('comment-small') ?>
<?php endforeach ?>
2014-04-27 15:59:29 +02:00
<?php if (count($comments) > count($commentsToDisplay)): ?>
2014-04-27 14:44:06 +02:00
<a href="<?= \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 ?>