title = 'Галерея';
$this->params[ 'breadcrumbs' ][] = $this->title;
?>
= $this->title ?>
= Html::a(Yii::t('app', 'Добавить'), [ 'gallery-create' ], [ 'class' => 'btn btn-success' ]) ?>
= GridView::widget([
'options' => ['class'=>'style admin-all-pages-wr'],
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
[
'attribute' => 'gallery_id',
'label' => 'ID',
'filterOptions' => ['class' => 'text-center']
],
'name',
'date_add',
[
'attribute' => 'type',
'value' => function($model, $key, $index, $column) {
switch($model->type) {
case 2:
return 'Видео';
break;
default:
return 'Фото';
break;
}
},
'label' => 'Фото или Видео',
'filter' => [
1 => 'Фото',
2 => 'Видео',
]
],
[
'class' => 'yii\grid\ActionColumn',
'buttons' => [
'update' => function($url, $model, $key) {
return Html::a('
', ['gallery-update', 'id' => $model->gallery_id
],[
'title' => 'Редактировать',
]);
},
'delete' => function($url, $model, $key) {
return Html::a('
', ['gallery-delete', 'id' => $model->gallery_id], [
'title' => 'Удалить',
'aria-label' => 'Удалить',
'data-confirm' => 'Вы уверены, что хотите удалить этот элемент?',
'data-method' => 'post',
'data-pjax' => '0',
]);
},
],
'template' => '{update} {delete}'
],
],
]) ?>