Commit 09abb556850d63f7fd417b8453a333ea325f5920

Authored by Yarik
1 parent 31f7c78a

Yarik

frontend/config/main.php
@@ -29,7 +29,7 @@ return [ @@ -29,7 +29,7 @@ return [
29 'errorAction' => 'site/error', 29 'errorAction' => 'site/error',
30 ], 30 ],
31 'urlManager' => [ 31 'urlManager' => [
32 - 'enablePrettyUrl' => false, 32 + 'enablePrettyUrl' => true,
33 'showScriptName' => false, 33 'showScriptName' => false,
34 'rules' => [ 34 'rules' => [
35 ], 35 ],
frontend/views/road-to-category/index.php
1 <?php 1 <?php
2 2
3 -use yii\helpers\Html; 3 + use common\models\RoadToCategory;
  4 + use yii\helpers\Html;
4 use yii\grid\GridView; 5 use yii\grid\GridView;
5 6
6 /* @var $this yii\web\View */ 7 /* @var $this yii\web\View */
7 /* @var $searchModel common\models\RoadToCategorySearch */ 8 /* @var $searchModel common\models\RoadToCategorySearch */
8 /* @var $dataProvider yii\data\ActiveDataProvider */ 9 /* @var $dataProvider yii\data\ActiveDataProvider */
9 10
10 -$this->title = 'Road To Categories'; 11 +$this->title = 'Категорії доріг';
11 $this->params['breadcrumbs'][] = $this->title; 12 $this->params['breadcrumbs'][] = $this->title;
12 ?> 13 ?>
13 <div class="road-to-category-index"> 14 <div class="road-to-category-index">
@@ -23,14 +24,51 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -23,14 +24,51 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
23 'filterModel' => $searchModel, 24 'filterModel' => $searchModel,
24 'columns' => [ 25 'columns' => [
25 ['class' => 'yii\grid\SerialColumn'], 26 ['class' => 'yii\grid\SerialColumn'],
26 -  
27 - 'road_to_category_id',  
28 - 'region_id',  
29 - 'road_id',  
30 - 'begin',  
31 - 'end',  
32 - // 'distance',  
33 - // 'road_category_id', 27 + [
  28 + 'attribute' => 'region_id',
  29 + 'value' => function($model) {
  30 + /**
  31 + * @var RoadToCategory $model
  32 + */
  33 + return $model->region->name;
  34 + }
  35 + ],
  36 + [
  37 + 'attribute' => 'road_id',
  38 + 'value' => function($model) {
  39 + /**
  40 + * @var RoadToCategory $model
  41 + */
  42 + return $model->road->name;
  43 + }
  44 + ],
  45 + [
  46 + 'attribute' => 'begin',
  47 + 'value' => function($model) {
  48 + /**
  49 + * @var RoadToCategory $model
  50 + */
  51 + return $model->getBeginString();
  52 + }
  53 + ],
  54 + [
  55 + 'attribute' => 'end',
  56 + 'value' => function($model) {
  57 + /**
  58 + * @var RoadToCategory $model
  59 + */
  60 + return $model->getEndString();
  61 + }
  62 + ],
  63 + [
  64 + 'attribute' => 'road_category_id',
  65 + 'value' => function($model) {
  66 + /**
  67 + * @var RoadToCategory $model
  68 + */
  69 + return $model->roadCategory->value;
  70 + }
  71 + ],
34 72
35 ['class' => 'yii\grid\ActionColumn'], 73 ['class' => 'yii\grid\ActionColumn'],
36 ], 74 ],