szurubooru/src/Views/comment-small.phtml

67 lines
2 KiB
PHTML
Raw Normal View History

<?php
2014-04-29 21:35:29 +02:00
Assets::addStylesheet('comment-small.css');
Assets::addStylesheet('comment-edit.css');
Assets::addScript('comment-edit.js');
?>
<div class="comment">
<div class="avatar">
<?php $commenter = $this->context->comment->getCommenter() ?>
<?php if ($commenter): ?>
2014-04-29 21:35:29 +02:00
<a href="<?= \Chibi\Router::linkTo(['UserController', 'viewAction'], ['name' => $commenter->name]) ?>">
2014-04-27 14:44:06 +02:00
<img src="<?= htmlspecialchars($commenter->getAvatarUrl(40)) ?>" alt="<?= $commenter->name ?>"/>
</a>
<?php else: ?>
2014-04-27 15:59:29 +02:00
<img
2014-04-29 21:35:29 +02:00
src="<?= \Chibi\Util\Url::makeAbsolute('/media/img/pixel.gif') ?>"
2014-04-27 15:59:29 +02:00
alt="<?= UserModel::getAnonymousName() ?>">
<?php endif ?>
</div>
<div class="body">
<div class="header">
<span class="nickname">
<?php if ($commenter): ?>
2014-04-29 21:35:29 +02:00
<a href="<?= \Chibi\Router::linkTo(['UserController', 'viewAction'], ['name' => $commenter->name]) ?>">
2014-04-27 14:44:06 +02:00
<?= $commenter->name ?>
</a>
<?php else: ?>
2014-04-27 14:44:06 +02:00
<?= UserModel::getAnonymousName() ?>
<?php endif ?>
</span>
2014-04-27 14:44:06 +02:00
<span class="date" title="<?= TextHelper::formatDate($this->context->comment->commentDate, true) ?>">
<?= TextHelper::formatDate($this->context->comment->commentDate, false) ?>
</span>
2013-10-17 23:37:41 +02:00
<?php if (Access::check(
2014-04-27 15:59:29 +02:00
Privilege::EditComment,
Access::getIdentity($commenter))): ?>
<span class="edit">
2014-04-29 21:35:29 +02:00
<a href="<?= \Chibi\Router::linkTo(['CommentController', 'editAction'], ['id' => $this->context->comment->id]) ?>">
edit
</a>
</span>
<?php endif ?>
2014-04-27 15:59:29 +02:00
<?php if (
Access::check(Privilege::DeleteComment,
Access::getIdentity($commenter))): ?>
2013-10-17 23:37:41 +02:00
<span class="delete">
2014-04-29 21:35:29 +02:00
<a href="<?= \Chibi\Router::linkTo(['CommentController', 'deleteAction'], ['id' => $this->context->comment->id]) ?>"
2014-04-27 15:59:29 +02:00
class="simple-action confirmable"
data-confirm-text="Are you sure you want to delete this comment?">
2013-10-17 23:37:41 +02:00
delete
</a>
</span>
<?php endif ?>
</div>
<div class="content">
2014-04-27 14:44:06 +02:00
<?= $this->context->comment->getText() ?>
</div>
</div>
<div class="clear"></div>
</div>