Commit d44eaf8b by dianc

Theme Menu Generation

parent 8e5dab8a
...@@ -65,9 +65,6 @@ use trntv\filekit\widget\Upload; ...@@ -65,9 +65,6 @@ use trntv\filekit\widget\Upload;
</div> </div>
</div> </div>
</div>
<?php ActiveForm::end(); ?> <?php ActiveForm::end(); ?>
</div> </div>
...@@ -11,29 +11,51 @@ use yii\bootstrap\ActiveForm; ...@@ -11,29 +11,51 @@ use yii\bootstrap\ActiveForm;
<div class="theme-form"> <div class="theme-form">
<?php $form = ActiveForm::begin(); ?> <?php $form = ActiveForm::begin(); ?>
<div id="myTabContent" class="tab-content">
<?= $form->errorSummary($model); ?> <div class="tab-pane fade in active" id="info">
<div class="page-header">
<?= $form->field($model, 'category_id')->textInput() ?> <h3> <?= Yii::t('backend', 'Info') ?> </h3>
</div>
<?= $form->field($model, 'code')->textInput(['maxlength' => true]) ?> <div class="row">
<div class="col-md-6">
<?= $form->field($model, 'slug')->textInput(['maxlength' => true]) ?> <?= $form->field($model, 'category_id')->textInput() ?>
</div>
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?> </div>
<div class="row">
<?= $form->field($model, 'description')->textInput(['maxlength' => true]) ?> <div class="col-md-6">
<?= $form->field($model, 'code')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'status')->textInput() ?> </div>
</div>
<?= $form->field($model, 'created_at')->textInput() ?> <div class="row">
<div class="col-md-6">
<?= $form->field($model, 'updated_at')->textInput() ?> <?= $form->field($model, 'slug')->textInput(['maxlength' => true]) ?>
</div>
<div class="form-group"> </div>
<?= Html::submitButton($model->isNewRecord ? Yii::t('backend', 'Create') : Yii::t('backend', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> <div class="row">
</div> <div class="col-md-6">
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<?php ActiveForm::end(); ?> </div>
</div>
</div> <div class="row">
<div class="col-md-6">
<?= $form->field($model, 'description')->textInput(['maxlength' => true]) ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'status')->dropDownList($model::statuses(), ['prompt' => '']) ?>
</div>
</div>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('backend', 'Create') : Yii::t('backend', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<div class="tab-pane fade in" id="files">
<div class="page-header">
<h3>Files</h3>
</div>
</div>
<?php ActiveForm::end(); ?>
</div>
...@@ -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\Theme;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $searchModel backend\modules\theme\models\search\ThemeSearch */ /* @var $searchModel backend\modules\theme\models\search\ThemeSearch */
...@@ -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',
'category_id', // 'category_id',
'code', 'code',
'slug', 'slug',
'name', 'name',
// 'description', // 'description',
[
'class' => EnumColumn::className(),
'attribute' => 'status',
'enum' => Theme::statuses(),
'filter' => Theme::statuses()
],
// 'status', // 'status',
// 'created_at', // 'created_at',
// 'updated_at', // 'updated_at',
......
...@@ -202,6 +202,12 @@ $bundle = BackendAsset::register($this); ...@@ -202,6 +202,12 @@ $bundle = BackendAsset::register($this);
'visible' => Yii::$app->user->can('administrator') 'visible' => Yii::$app->user->can('administrator')
], ],
[ [
'label' => Yii::t('backend', 'Theme'),
'icon' => '<i class="fa fa-sitemap"></i>',
'url' => ['/theme/theme/index'],
'visible' => Yii::$app->user->can('administrator')
],
[
'label' => Yii::t('backend', 'Location'), 'label' => Yii::t('backend', 'Location'),
'icon' => '<i class="fa fa-map"></i>', 'icon' => '<i class="fa fa-map"></i>',
'url' => '#', 'url' => '#',
......
...@@ -22,6 +22,8 @@ use Yii; ...@@ -22,6 +22,8 @@ use Yii;
*/ */
class Theme extends \yii\db\ActiveRecord class Theme extends \yii\db\ActiveRecord
{ {
const STATUS_ACTIVE = 1;
const STATUS_IN_ACTIVE = 2;
/** /**
* @inheritdoc * @inheritdoc
*/ */
...@@ -86,4 +88,12 @@ class Theme extends \yii\db\ActiveRecord ...@@ -86,4 +88,12 @@ class Theme extends \yii\db\ActiveRecord
{ {
return new \common\models\query\ThemeQuery(get_called_class()); return new \common\models\query\ThemeQuery(get_called_class());
} }
public static function statuses()
{
return [
self::STATUS_ACTIVE => Yii::t('common', 'Active'),
self::STATUS_IN_ACTIVE => Yii::t('common', 'In Active'),
];
}
} }
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