Commit d44eaf8b by dianc

Theme Menu Generation

parent 8e5dab8a
......@@ -65,9 +65,6 @@ use trntv\filekit\widget\Upload;
</div>
</div>
</div>
<?php ActiveForm::end(); ?>
</div>
......@@ -11,29 +11,51 @@ use yii\bootstrap\ActiveForm;
<div class="theme-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->errorSummary($model); ?>
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade in active" id="info">
<div class="page-header">
<h3> <?= Yii::t('backend', 'Info') ?> </h3>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'category_id')->textInput() ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'code')->textInput(['maxlength' => true]) ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'slug')->textInput(['maxlength' => true]) ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'description')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'status')->textInput() ?>
<?= $form->field($model, 'created_at')->textInput() ?>
<?= $form->field($model, 'updated_at')->textInput() ?>
</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>
</div>
......@@ -2,6 +2,8 @@
use yii\helpers\Html;
use yii\grid\GridView;
use common\grid\EnumColumn;
use common\models\Theme;
/* @var $this yii\web\View */
/* @var $searchModel backend\modules\theme\models\search\ThemeSearch */
......@@ -26,12 +28,18 @@ $this->params['breadcrumbs'][] = $this->title;
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
'category_id',
// 'id',
// 'category_id',
'code',
'slug',
'name',
// 'description',
[
'class' => EnumColumn::className(),
'attribute' => 'status',
'enum' => Theme::statuses(),
'filter' => Theme::statuses()
],
// 'status',
// 'created_at',
// 'updated_at',
......
......@@ -202,6 +202,12 @@ $bundle = BackendAsset::register($this);
'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'),
'icon' => '<i class="fa fa-map"></i>',
'url' => '#',
......
......@@ -22,6 +22,8 @@ use Yii;
*/
class Theme extends \yii\db\ActiveRecord
{
const STATUS_ACTIVE = 1;
const STATUS_IN_ACTIVE = 2;
/**
* @inheritdoc
*/
......@@ -86,4 +88,12 @@ class Theme extends \yii\db\ActiveRecord
{
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