szurubooru/src/Views/comment-small.phtml
Marcin Kurczewski 35cdc0cf3a Refactored scripts and stylesheets
Styles, scripts and page titles are no longer set from controllers level.
Changed because it was breaking MVC pattern and led to spaghetti code.

Also, optimized JS/CSS inclusions a bit.
2014-02-01 11:24:03 +01:00

58 lines
2 KiB
PHTML

<?php
LayoutHelper::addStylesheet('comment-small.css');
LayoutHelper::addStylesheet('comment-edit.css');
LayoutHelper::addScript('comment-edit.js');
?>
<div class="comment">
<div class="avatar">
<?php $commenter = $this->context->comment->getCommenter() ?>
<?php if ($commenter): ?>
<a href="<?php echo \Chibi\UrlHelper::route('user', 'view', ['name' => $commenter->name]) ?>">
<img src="<?php echo htmlspecialchars($commenter->getAvatarUrl(40)) ?>" alt="<?php echo $commenter->name ?>"/>
</a>
<?php else: ?>
<img src="<?php echo \Chibi\UrlHelper::absoluteUrl('/media/img/pixel.gif') ?>" alt="<?php echo UserModel::getAnonymousName() ?>">
<?php endif ?>
</div>
<div class="body">
<div class="header">
<span class="nickname">
<?php if ($commenter): ?>
<a href="<?php echo \Chibi\UrlHelper::route('user', 'view', ['name' => $commenter->name]) ?>">
<?php echo $commenter->name ?>
</a>
<?php else: ?>
<?php echo UserModel::getAnonymousName() ?>
<?php endif ?>
</span>
<span class="date">
<?php echo date('Y-m-d H:i', $this->context->comment->commentDate) ?>
</span>
<?php if (PrivilegesHelper::confirm(Privilege::EditComment, PrivilegesHelper::getIdentitySubPrivilege($commenter))): ?>
<span class="edit">
<a href="<?php echo \Chibi\UrlHelper::route('comment', 'edit', ['id' => $this->context->comment->id]) ?>">
edit
</a>
</span>
<?php endif ?>
<?php if (PrivilegesHelper::confirm(Privilege::DeleteComment, PrivilegesHelper::getIdentitySubPrivilege($commenter))): ?>
<span class="delete">
<a class="simple-action confirmable" href="<?php echo \Chibi\UrlHelper::route('comment', 'delete', ['id' => $this->context->comment->id]) ?>" data-confirm-text="Are you sure you want to delete this comment?">
delete
</a>
</span>
<?php endif ?>
</div>
<div class="content">
<?php echo $this->context->comment->getText() ?>
</div>
</div>
<div class="clear"></div>
</div>