You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.4 KiB

7 years ago
<?php
3 years ago
use core\entities\post\Post;
use core\entities\post\PostComment;
7 years ago
use yii\helpers\Html;
use yii\widgets\DetailView;
use core\entities\user\User;
/* @var $this yii\web\View */
3 years ago
/* @var $post Post */
/* @var $comment PostComment */
7 years ago
/* @var $modificationsProvider yii\data\ActiveDataProvider */
$this->title = $post->title;
$this->params['breadcrumbs'][] = ['label' => Yii::t('post', 'Comments'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-view">
<p>
<?= Html::a(Yii::t('post', 'Comments'), ['index'], ['class' => 'btn btn-default']) ?>
<?= Html::a(Yii::t('buttons', 'Edit'), ['update', 'post_id' => $post->id, 'id' => $comment->id], ['class' => 'btn btn-primary']) ?>
<?php if ($comment->isActive()): ?>
<?= Html::a(Yii::t('buttons', 'Delete'), ['delete', 'post_id' => $post->id, 'id' => $comment->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => Yii::t('buttons', 'Are you sure you want to delete this item?'),
'method' => 'post',
],
]) ?>
<?php else: ?>
<?= Html::a(Yii::t('buttons', 'Restore'), ['activate', 'post_id' => $post->id, 'id' => $comment->id], [
'class' => 'btn btn-success',
'data' => [
'confirm' => Yii::t('buttons', 'Are you sure you want to activate this item?'),
'method' => 'post',
],
]) ?>
<?php endif; ?>
</p>
<div class="box">
<div class="box-body">
<?= DetailView::widget([
'model' => $comment,
'attributes' => [
'id',
'created_at:boolean',
'active:boolean',
[
'attribute' => 'user_id',
3 years ago
'value' => function(PostComment $comment) {
7 years ago
return User::findOne($comment->user_id)->username;
},
],
'parent_id',
[
'attribute' => 'post_id',
'value' => $post->title,
],
],
]) ?>
</div>
</div>
<div class="box">
<div class="box-body">
<?= Yii::$app->formatter->asNtext($comment->text) ?>
</div>
</div>
</div>