szurubooru/src/Views/comment-small.phtml

59 lines
2 KiB
PHTML
Raw Normal View History

<?php
2014-02-27 15:04:36 +01:00
CustomAssetViewDecorator::addStylesheet('comment-small.css');
CustomAssetViewDecorator::addStylesheet('comment-edit.css');
CustomAssetViewDecorator::addScript('comment-edit.js');
?>
<div class="comment">
<div class="avatar">
<?php $commenter = $this->context->comment->getCommenter() ?>
<?php if ($commenter): ?>
2014-04-27 14:44:06 +02:00
<a href="<?= \Chibi\UrlHelper::route('user', 'view', ['name' => $commenter->name]) ?>">
<img src="<?= htmlspecialchars($commenter->getAvatarUrl(40)) ?>" alt="<?= $commenter->name ?>"/>
</a>
<?php else: ?>
2014-04-27 14:44:06 +02:00
<img src="<?= \Chibi\UrlHelper::absoluteUrl('/media/img/pixel.gif') ?>" alt="<?= UserModel::getAnonymousName() ?>">
<?php endif ?>
</div>
<div class="body">
<div class="header">
<span class="nickname">
<?php if ($commenter): ?>
2014-04-27 14:44:06 +02:00
<a href="<?= \Chibi\UrlHelper::route('user', 'view', ['name' => $commenter->name]) ?>">
<?= $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 (PrivilegesHelper::confirm(Privilege::EditComment, PrivilegesHelper::getIdentitySubPrivilege($commenter))): ?>
<span class="edit">
2014-04-27 14:44:06 +02:00
<a href="<?= \Chibi\UrlHelper::route('comment', 'edit', ['id' => $this->context->comment->id]) ?>">
edit
</a>
</span>
<?php endif ?>
<?php if (PrivilegesHelper::confirm(Privilege::DeleteComment, PrivilegesHelper::getIdentitySubPrivilege($commenter))): ?>
2013-10-17 23:37:41 +02:00
<span class="delete">
2014-04-27 14:44:06 +02:00
<a class="simple-action confirmable" href="<?= \Chibi\UrlHelper::route('comment', 'delete', ['id' => $this->context->comment->id]) ?>" 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>