Commit 8e356b8c3cdc49f8ea34396910a42cae1fec09bb
1 parent
20cfd476
-Sizes half way done
Showing
4 changed files
with
79 additions
and
57 deletions
Show diff stats
controllers/BrandController.php
| ... | ... | @@ -24,31 +24,32 @@ |
| 24 | 24 | public function behaviors() |
| 25 | 25 | { |
| 26 | 26 | return [ |
| 27 | - 'access' => [ | |
| 28 | - 'class' => AccessControl::className(), | |
| 29 | - 'rules' => [ | |
| 30 | - [ | |
| 31 | - 'actions' => [ | |
| 32 | - 'login', | |
| 33 | - 'error', | |
| 34 | - ], | |
| 35 | - 'allow' => true, | |
| 36 | - ], | |
| 37 | - [ | |
| 38 | - 'actions' => [ | |
| 39 | - 'logout', | |
| 40 | - 'index', | |
| 41 | - 'create', | |
| 42 | - 'update', | |
| 43 | - 'view', | |
| 44 | - 'delete', | |
| 45 | - 'delete-image', | |
| 46 | - ], | |
| 47 | - 'allow' => true, | |
| 48 | - 'roles' => [ '@' ], | |
| 49 | - ], | |
| 50 | - ], | |
| 51 | - ], | |
| 27 | +// 'access' => [ | |
| 28 | +// 'class' => AccessControl::className(), | |
| 29 | +// 'rules' => [ | |
| 30 | +// [ | |
| 31 | +// 'actions' => [ | |
| 32 | +// 'login', | |
| 33 | +// 'error', | |
| 34 | +// ], | |
| 35 | +// 'allow' => true, | |
| 36 | +// ], | |
| 37 | +// [ | |
| 38 | +// 'actions' => [ | |
| 39 | +// 'logout', | |
| 40 | +// 'index', | |
| 41 | +// 'create', | |
| 42 | +// 'update', | |
| 43 | +// 'view', | |
| 44 | +// 'delete', | |
| 45 | +// 'delete-image', | |
| 46 | +// 'size', | |
| 47 | +// ], | |
| 48 | +// 'allow' => true, | |
| 49 | +// 'roles' => [ '@' ], | |
| 50 | +// ], | |
| 51 | +// ], | |
| 52 | +// ], | |
| 52 | 53 | 'verbs' => [ |
| 53 | 54 | 'class' => VerbFilter::className(), |
| 54 | 55 | 'actions' => [ | ... | ... |
models/Product.php
views/brand/index.php
| ... | ... | @@ -17,35 +17,48 @@ |
| 17 | 17 | $this->params[ 'breadcrumbs' ][] = $this->title; |
| 18 | 18 | ?> |
| 19 | 19 | <div class="brand-index"> |
| 20 | - | |
| 21 | - <h1><?= Html::encode($this->title) ?></h1> | |
| 22 | - | |
| 23 | - <p> | |
| 24 | - <?= Html::a(Yii::t('product', 'Create Brand'), [ 'create' ], [ 'class' => 'btn btn-success' ]) ?> | |
| 25 | - </p> | |
| 26 | - <?= GridView::widget([ | |
| 27 | - 'dataProvider' => $dataProvider, | |
| 28 | - 'filterModel' => $searchModel, | |
| 29 | - 'columns' => [ | |
| 30 | - 'id', | |
| 31 | - [ | |
| 32 | - 'attribute' => 'brandName', | |
| 33 | - 'value' => 'lang.title', | |
| 34 | - ], | |
| 35 | - 'imageUrl:image', | |
| 36 | - [ | |
| 37 | - 'attribute' => 'in_menu', | |
| 38 | - 'content' => function($model) { | |
| 39 | - /** | |
| 40 | - * @var Brand $model | |
| 41 | - */ | |
| 42 | - return Html::tag('span', '', [ | |
| 43 | - 'class' => 'glyphicon glyphicon-'.($model->in_menu?'ok':'remove'), | |
| 44 | - ]); | |
| 45 | - }, | |
| 20 | + | |
| 21 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 22 | + | |
| 23 | + <p> | |
| 24 | + <?= Html::a(Yii::t('product', 'Create Brand'), [ 'create' ], [ 'class' => 'btn btn-success' ]) ?> | |
| 25 | + </p> | |
| 26 | + <?= GridView::widget( | |
| 27 | + [ | |
| 28 | + 'dataProvider' => $dataProvider, | |
| 29 | + 'filterModel' => $searchModel, | |
| 30 | + 'columns' => [ | |
| 31 | + 'id', | |
| 32 | + [ | |
| 33 | + 'attribute' => 'brandName', | |
| 34 | + 'value' => 'lang.title', | |
| 35 | + ], | |
| 36 | + 'imageUrl:image', | |
| 37 | + [ | |
| 38 | + 'attribute' => 'in_menu', | |
| 39 | + 'content' => function($model) { | |
| 40 | + /** | |
| 41 | + * @var Brand $model | |
| 42 | + */ | |
| 43 | + return Html::tag( | |
| 44 | + 'span', | |
| 45 | + '', | |
| 46 | + [ | |
| 47 | + 'class' => 'glyphicon glyphicon-' . ( $model->in_menu ? 'ok' : 'remove' ), | |
| 48 | + ] | |
| 49 | + ); | |
| 50 | + }, | |
| 51 | + ], | |
| 52 | + [ | |
| 53 | + 'class' => 'yii\grid\ActionColumn', | |
| 54 | + 'buttons' => [ | |
| 55 | + 'size' => function($url, $model) { | |
| 56 | + return Html::a('<i class="fa fa-table"></i>', ['size', 'id' => $model->id]); | |
| 57 | + }, | |
| 58 | + ], | |
| 59 | + 'template' => '{size} {view} {update} {delete}', | |
| 60 | + ], | |
| 46 | 61 | ], |
| 47 | - [ 'class' => 'yii\grid\ActionColumn', | |
| 48 | - ], | |
| 49 | - ], | |
| 50 | - ]); ?> | |
| 62 | + ] | |
| 63 | + ); ?> | |
| 51 | 64 | </div> | ... | ... |
views/brand/size.php
| ... | ... | @@ -21,7 +21,7 @@ |
| 21 | 21 | <?php // echo $this->render('_search', ['model' => $searchModel]); ?> |
| 22 | 22 | |
| 23 | 23 | <p> |
| 24 | - <?= Html::a(Yii::t('app', 'Create Brand Size'), [ 'create' ], [ 'class' => 'btn btn-success' ]) ?> | |
| 24 | + <?= Html::a(Yii::t('app', 'Create Brand Size'), [ 'brand-size/create' ], [ 'class' => 'btn btn-success' ]) ?> | |
| 25 | 25 | </p> |
| 26 | 26 | <?= GridView::widget( |
| 27 | 27 | [ |
| ... | ... | @@ -33,7 +33,10 @@ |
| 33 | 33 | 'brand_id', |
| 34 | 34 | 'image', |
| 35 | 35 | |
| 36 | - [ 'class' => 'yii\grid\ActionColumn' ], | |
| 36 | + [ | |
| 37 | + 'class' => 'yii\grid\ActionColumn', | |
| 38 | + 'controller' => 'brand-size', | |
| 39 | + ], | |
| 37 | 40 | ], |
| 38 | 41 | ] |
| 39 | 42 | ); ?> | ... | ... |