From a65e775934945e913c7f7f86a5895ea96610c785 Mon Sep 17 00:00:00 2001 From: Zura Sekhniashvili Date: Thu, 26 Oct 2017 14:41:18 +0400 Subject: [PATCH] Fix i18n source message create translation bug --- controllers/I18nController.php | 10 ++-------- views/i18n/create.php | 3 +-- views/i18n/update.php | 4 +--- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/controllers/I18nController.php b/controllers/I18nController.php index c74125f..3fa5561 100644 --- a/controllers/I18nController.php +++ b/controllers/I18nController.php @@ -73,7 +73,7 @@ public function actionCreate() if ($model->load(Yii::$app->request->post(), null) && $model->save()) { return $this->redirect(['index']); } - return $this->render('update', [ + return $this->render('create', [ 'model' => $model, 'locales' => $locales ]); @@ -92,17 +92,11 @@ public function actionUpdate($id) if ($model->load(Yii::$app->request->post(), null) && $model->save()) { return $this->redirect(['index']); } - $categories = ArrayHelper::map( - I18nSourceMessage::find()->select('category')->distinct()->all(), - 'category', - 'category' - ); $locales = LocaleHelper::getAvailableLocales(); return $this->render('update', [ 'model' => $model, - 'locales' => $locales, - 'categories' => $categories + 'locales' => $locales ]); } diff --git a/views/i18n/create.php b/views/i18n/create.php index aff4759..038bc04 100644 --- a/views/i18n/create.php +++ b/views/i18n/create.php @@ -14,8 +14,7 @@ render('_form', [ 'model' => $model, - 'locales' => $locales, - 'categories' => $categories + 'locales' => $locales ]) ?> diff --git a/views/i18n/update.php b/views/i18n/update.php index b800f86..16d706a 100644 --- a/views/i18n/update.php +++ b/views/i18n/update.php @@ -8,7 +8,6 @@ /* @var $this yii\web\View */ /* @var $model centigen\i18ncontent\models\I18nSourceMessage */ /* @var $locales array */ -/* @var $categories array */ $this->title = Yii::t('i18ncontent', 'Update {modelClass}: ', [ 'modelClass' => 'I18n message', @@ -20,8 +19,7 @@ render('_form', [ 'model' => $model, - 'locales' => $locales, - 'categories' => $categories + 'locales' => $locales ]) ?>