Commit 64f417aa by dianc

Category Updated-3

parent 7bd28bad
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
use yii\helpers\Html; use yii\helpers\Html;
use yii\bootstrap\ActiveForm; use yii\bootstrap\ActiveForm;
use trntv\filekit\widget\Upload;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\models\Category */ /* @var $model common\models\Category */
...@@ -31,10 +32,11 @@ use yii\bootstrap\ActiveForm; ...@@ -31,10 +32,11 @@ use yii\bootstrap\ActiveForm;
<?= $form->field($model, 'status')->dropDownList($model::statuses(), ['prompt' => '']) ?> <?= $form->field($model, 'status')->dropDownList($model::statuses(), ['prompt' => '']) ?>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-3"> <div class="col-md-3">
<?= $form->field($model, 'image')->widget( <?= $form->field($model, 'image')->widget(
\trntv\filekit\widget\Upload::className(), Upload::className(),
[ [
'url' => ['/file-storage/upload'], 'url' => ['/file-storage/upload'],
])->label('Image(1280x854)'); ])->label('Image(1280x854)');
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
use yii\helpers\Html; use yii\helpers\Html;
use yii\grid\GridView; use yii\grid\GridView;
use common\grid\EnumColumn;
use common\models\Category;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $searchModel backend\modules\theme\models\search\CategorySearch */ /* @var $searchModel backend\modules\theme\models\search\CategorySearch */
...@@ -26,12 +28,18 @@ $this->params['breadcrumbs'][] = $this->title; ...@@ -26,12 +28,18 @@ $this->params['breadcrumbs'][] = $this->title;
'columns' => [ 'columns' => [
['class' => 'yii\grid\SerialColumn'], ['class' => 'yii\grid\SerialColumn'],
'id', //'id',
'name', 'name',
'slug', // 'slug',
'description', 'description',
'image_url:url', // 'image_url:url',
// 'image_path', // 'image_path',
[
'class' => EnumColumn::className(),
'attribute' => 'status',
'enum' => Category::statuses(),
'filter' => Category::statuses()
],
// 'status', // 'status',
// 'created_at', // 'created_at',
// 'updated_at', // 'updated_at',
......
...@@ -49,6 +49,7 @@ class Category extends \yii\db\ActiveRecord ...@@ -49,6 +49,7 @@ class Category extends \yii\db\ActiveRecord
[['name', 'slug'], 'string', 'max' => 32], [['name', 'slug'], 'string', 'max' => 32],
[['description'], 'string', 'max' => 512], [['description'], 'string', 'max' => 512],
[['image_url', 'image_path'], 'string', 'max' => 1024], [['image_url', 'image_path'], 'string', 'max' => 1024],
[['image'], 'safe']
]; ];
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment