Commit 1317fa6874d3a2a721738327b359b32501f7ccdd
1 parent
920dd24d
-Comments started
Showing
1 changed file
with
14 additions
and
9 deletions
Show diff stats
views/manage/index.php
| 1 | <?php | 1 | <?php |
| 2 | + use artweb\artbox\comment\models\CommentModel; | ||
| 2 | use artweb\artbox\comment\models\CommentModelSearch; | 3 | use artweb\artbox\comment\models\CommentModelSearch; |
| 3 | use yii\data\ActiveDataProvider; | 4 | use yii\data\ActiveDataProvider; |
| 4 | use yii\grid\GridView; | 5 | use yii\grid\GridView; |
| 6 | + use yii\grid\SerialColumn; | ||
| 5 | use yii\helpers\Html; | 7 | use yii\helpers\Html; |
| 8 | + use yii\helpers\StringHelper; | ||
| 6 | use yii\widgets\Pjax; | 9 | use yii\widgets\Pjax; |
| 7 | 10 | ||
| 8 | /** | 11 | /** |
| @@ -24,12 +27,7 @@ | @@ -24,12 +27,7 @@ | ||
| 24 | 'filterModel' => $searchModel, | 27 | 'filterModel' => $searchModel, |
| 25 | 'columns' => [ | 28 | 'columns' => [ |
| 26 | [ | 29 | [ |
| 27 | - 'class' => 'yii\grid\ActionColumn', | ||
| 28 | - 'template' => '{update} {delete}', | ||
| 29 | - ], | ||
| 30 | - [ | ||
| 31 | - 'attribute' => 'artbox_comment_id', | ||
| 32 | - 'label' => 'Идентификатор', | 30 | + 'class' => SerialColumn::className(), |
| 33 | ], | 31 | ], |
| 34 | [ | 32 | [ |
| 35 | 'attribute' => 'created_at', | 33 | 'attribute' => 'created_at', |
| @@ -39,7 +37,12 @@ | @@ -39,7 +37,12 @@ | ||
| 39 | ], | 37 | ], |
| 40 | 'filter' => false, | 38 | 'filter' => false, |
| 41 | ], | 39 | ], |
| 42 | - 'text:text', | 40 | + [ |
| 41 | + 'label' => 'Комментарий', | ||
| 42 | + 'content' => function(CommentModel $model) { | ||
| 43 | + return StringHelper::truncate($model->text, 40, '...'); | ||
| 44 | + } | ||
| 45 | + ], | ||
| 43 | [ | 46 | [ |
| 44 | 'attribute' => 'user_id', | 47 | 'attribute' => 'user_id', |
| 45 | 'value' => function($model) { | 48 | 'value' => function($model) { |
| @@ -66,14 +69,16 @@ | @@ -66,14 +69,16 @@ | ||
| 66 | return NULL; | 69 | return NULL; |
| 67 | }, | 70 | }, |
| 68 | ], | 71 | ], |
| 69 | - 'entity', | ||
| 70 | - 'entity_id', | ||
| 71 | [ | 72 | [ |
| 72 | 'attribute' => 'childrenCount', | 73 | 'attribute' => 'childrenCount', |
| 73 | 'value' => function($model) { | 74 | 'value' => function($model) { |
| 74 | return count($model->children); | 75 | return count($model->children); |
| 75 | }, | 76 | }, |
| 76 | ], | 77 | ], |
| 78 | + [ | ||
| 79 | + 'class' => 'yii\grid\ActionColumn', | ||
| 80 | + 'template' => '{update} {delete}', | ||
| 81 | + ], | ||
| 77 | ], | 82 | ], |
| 78 | ]); | 83 | ]); |
| 79 | Pjax::end(); | 84 | Pjax::end(); |
| 80 | \ No newline at end of file | 85 | \ No newline at end of file |