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.
72 lines
2.5 KiB
72 lines
2.5 KiB
7 years ago
|
<?php
|
||
|
|
||
|
use yii\helpers\Html;
|
||
|
use yii\widgets\DetailView;
|
||
|
use core\entities\user\User;
|
||
|
use common\modules\blog\entities\BlogComment;
|
||
|
|
||
|
/* @var $this yii\web\View */
|
||
|
/* @var $post \common\modules\blog\entities\BlogPost */
|
||
|
/* @var $comment BlogComment */
|
||
|
/* @var $modificationsProvider yii\data\ActiveDataProvider */
|
||
|
|
||
|
$this->title = $post->title;
|
||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('blog', 'Comments'), 'url' => ['index']];
|
||
|
$this->params['breadcrumbs'][] = $this->title;
|
||
|
?>
|
||
|
<div class="user-view">
|
||
|
|
||
|
<p>
|
||
|
<?= Html::a(Yii::t('blog', '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(BlogComment $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>
|