szurubooru/src/Views/comment-list.phtml
2014-05-03 20:34:07 +02:00

48 lines
1.5 KiB
PHTML

<?php
Assets::setSubTitle('comments');
?>
<?php if (empty($this->context->transport->posts)): ?>
<p class="alert alert-warning">No comments to show.</p>
<?php else: ?>
<?php
Assets::addStylesheet('comment-list.css');
Assets::addStylesheet('comment-small.css');
Assets::addStylesheet('comment-edit.css');
Assets::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;
$comments = array_reverse($post->getComments());
$commentsToDisplay = array_slice($comments, 0, getConfig()->comments->maxCommentsInList);
?>
<?php \Chibi\View::render('post-small', $this->context) ?>
</div>
<div class="comments">
<?php foreach ($commentsToDisplay as $comment): ?>
<?php $this->context->comment = $comment ?>
<?php \Chibi\View::render('comment-small', $this->context) ?>
<?php endforeach ?>
<?php if (count($comments) > count($commentsToDisplay)): ?>
<a href="<?= \Chibi\Router::linkTo(
['PostController', 'genericView'],
['id' => $this->context->post->id]) ?>">
<span class="hellip">(more&hellip;)</span>
</a>
<?php endif ?>
</div>
<div class="clear"></div>
</div>
<?php endforeach ?>
</div>
<?php \Chibi\View::render('paginator', $this->context) ?>
</div>
<?php endif ?>