szurubooru/src/Views/comment-list.phtml

49 lines
1.5 KiB
PHTML
Raw Normal View History

<?php
2014-04-29 21:35:29 +02:00
Assets::setSubTitle('comments');
?>
<?php if (empty($this->context->transport->posts)): ?>
<p class="alert alert-warning">No comments to show.</p>
<?php else: ?>
<?php
2014-04-29 21:35:29 +02:00
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">
2014-04-27 15:59:29 +02:00
<?php
$this->context->post = $post;
$comments = array_reverse($post->getComments());
2014-04-29 21:35:29 +02:00
$commentsToDisplay = array_slice($comments, 0, getConfig()->comments->maxCommentsInList);
2014-04-27 15:59:29 +02:00
?>
2014-04-29 21:35:29 +02:00
<?php \Chibi\View::render('post-small', $this->context) ?>
</div>
<div class="comments">
2014-04-27 15:59:29 +02:00
<?php foreach ($commentsToDisplay as $comment): ?>
<?php $this->context->comment = $comment ?>
2014-04-29 21:35:29 +02:00
<?php \Chibi\View::render('comment-small', $this->context) ?>
<?php endforeach ?>
2014-04-27 15:59:29 +02:00
<?php if (count($comments) > count($commentsToDisplay)): ?>
2014-04-30 00:11:13 +02:00
<a href="<?= \Chibi\Router::linkTo(
2014-05-03 20:32:47 +02:00
['PostController', 'genericView'],
2014-04-30 00:11:13 +02:00
['id' => $this->context->post->id]) ?>">
<span class="hellip">(more&hellip;)</span>
</a>
<?php endif ?>
</div>
<div class="clear"></div>
</div>
<?php endforeach ?>
</div>
2014-04-29 21:35:29 +02:00
<?php \Chibi\View::render('paginator', $this->context) ?>
</div>
<?php endif ?>