Commit 71b55384 by Junaid Rahman pv

Merge remote-tracking branch 'origin/development' into development

parents 8314fbdf 7c1c89be
......@@ -62,19 +62,18 @@ class CategoryController extends Controller
*/
public function actionCreate()
{
$model = new Category();
$this->layout = '@backend/modules/theme/views/category/layout.php';
// $model->scenario =
$model = new Category();
$model->status = $model::STATUS_ACTIVE;
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->render('create', [
'model' => $model,
]);
}
return $this->render('create', [
'model' => $model,
]);
}
/**
......@@ -85,15 +84,17 @@ class CategoryController extends Controller
*/
public function actionUpdate($id)
{
$this->layout = '@backend/modules/theme/views/category/layout.php';
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->render('update', [
'model' => $model,
]);
}
return $this->render('update', [
'model' => $model,
]);
}
/**
......
......@@ -18,7 +18,7 @@ class CategorySearch extends Category
public function rules()
{
return [
[['id', 'status', 'created_at', 'updated_at'], 'integer'],
[['id', 'status', 'updated_at'], 'integer'],
[['name', 'slug', 'description', 'image_url', 'image_path'], 'safe'],
];
}
......
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Category */
$this->params['categoryId'] = false;
$this->title = Yii::t('backend', 'Create {modelClass}', [
'modelClass' => 'Category',
]);
$this->params['breadcrumbs'][] = ['label' => Yii::t('backend', 'Categories'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="category-create">
<?= $this->render('_form', [
......
......@@ -40,11 +40,11 @@ $this->params['breadcrumbs'][] = $this->title;
'enum' => Category::statuses(),
'filter' => Category::statuses()
],
'status',
'created_at',
// 'updated_at',
['class' => 'yii\grid\ActionColumn'],
['class' => 'yii\grid\ActionColumn',
'template' => '{update}{delete}'],
],
]); ?>
......
<?php
use yii\widgets\Menu;
use common\models\Category;
/* @var $this yii\web\View */
?>
<?php $this->beginContent('@backend/views/layouts/main.php'); ?>
<?=
Menu::widget([
'items' => [
['label' => 'Info', 'url' => ['category/create']],
['label' => 'Files', 'url' => ['category/update', 'id' =>'' ]],
[
'label' => 'Info',
'url' => $this->params['categoryId'] ? [
'category/update',
'id' => $this->params['categoryId']
] : ['category/create'],
],
[
'label' => 'Files',
'url' => $this->params['categoryId'] ? [
'category/files',
'category_id' => $this->params['categoryId']
] : '#',
'options' => ['class' => $this->params['categoryId'] ? '' : 'disabled']
],
],
'options' => [
'class' => 'nav nav-tabs',
......@@ -21,7 +33,10 @@ Menu::widget([
]);
?>
<div id="myTabContent" class="tab-content">
<?php echo $content ?>
<div class="tab-content">
<?= $content ?>
</div>
<?php $this->endContent(); ?>
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Category */
$this->params['categoryId'] = $model->id;
$this->title = Yii::t('backend', 'Update {modelClass}: ', [
'modelClass' => 'Category',
]) . ' ' . $model->name;
'modelClass' => 'Category',
]) . ' ' . $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('backend', 'Categories'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = Yii::t('backend', 'Update');
?>
<div class="category-update">
<?= $this->render('_form', [
......
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