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.

57 lines
2.3 KiB

7 years ago
<?php
use common\modules\pages\entities\Page;
3 years ago
use common\modules\pages\forms\PageSearch;
7 years ago
use yii\grid\ActionColumn;
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
3 years ago
/* @var $searchModel PageSearch */
7 years ago
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('pages', 'Pages');
7 years ago
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-index">
3 years ago
<div class="card">
<div class="card-header">
<?= Html::a(Yii::t('pages','Create Page'), ['create'], ['class' => 'btn btn-success btn-sm']) ?>
</div>
<div class="card-body">
7 years ago
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
[
'attribute' => 'title',
'value' => function (Page $model) {
$indent = ($model->depth > 1 ? str_repeat('&nbsp;&nbsp;', $model->depth - 1) . ' ' : '');
$title = isset($model->findTranslation(Yii::$app->language)->title) ? $model->findTranslation(Yii::$app->language)->title : $model->findTranslation(Yii::$app->params['defaultLanguage'])->title;
return $indent . Html::a(Html::encode($title), ['view', 'id' => $model->id]);
7 years ago
},
'format' => 'raw',
],
[
'value' => function (Page $model) {
return
3 years ago
Html::a('<i class="fas fa-arrow-alt-circle-up"></i>', ['move-up', 'id' => $model->id]) .
Html::a('<i class="fas fa-arrow-alt-circle-down"></i>', ['move-down', 'id' => $model->id]);
7 years ago
},
'format' => 'raw',
'options' => ['style' => 'width: 100px;'],
'contentOptions' => ['style' => 'text-align: center'],
],
'slug',
[
'class' => ActionColumn::class,
'options' => ['style' => 'width: 100px;'],
'contentOptions' => ['class' => 'text-center'],
],
],
]); ?>
</div>
</div>
</div>