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.
71 lines
2.4 KiB
71 lines
2.4 KiB
7 years ago
|
<?php
|
||
|
|
||
|
use yii\helpers\Html;
|
||
|
use yii\widgets\DetailView;
|
||
|
use core\entities\user\User;
|
||
|
|
||
|
/* @var $this yii\web\View */
|
||
|
/* @var $post \core\entities\post\Post */
|
||
|
/* @var $comment \core\entities\post\PostComment */
|
||
|
/* @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',
|
||
|
'value' => function(\core\entities\post\PostComment $comment) {
|
||
|
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>
|