From c48826a7d66abe474bb8c47b7a4dc16a26fcf1a6 Mon Sep 17 00:00:00 2001 From: Egorka Date: Fri, 14 Sep 2018 19:34:12 +0300 Subject: [PATCH] Modules table system field migration Modules view button delete/install change to info dialog --- backend/messages/ru/main.php | 2 + backend/views/module/list.php | 105 ++++++++++++--------- backend/views/module/remote-list.php | 28 ++++-- .../m180914_163138_add_modules_system_field.php | 25 +++++ 4 files changed, 103 insertions(+), 57 deletions(-) create mode 100644 console/migrations/m180914_163138_add_modules_system_field.php diff --git a/backend/messages/ru/main.php b/backend/messages/ru/main.php index c632ba5..aea418a 100644 --- a/backend/messages/ru/main.php +++ b/backend/messages/ru/main.php @@ -79,4 +79,6 @@ return [ 'Error module archive' => 'Ошибка архива модуля', 'Module installed successful' => 'Модуль успешно установлен', 'Install' => 'Установить', + 'To remove the module, use the following command in the SSH console:' => 'Для удаления модуля введите в SSH консоли сервера команду:', + 'To install the module, use the following command in the SSH console:' => 'Для установки модуля введите в SSH консоли сервера команду:', ]; diff --git a/backend/views/module/list.php b/backend/views/module/list.php index 212a715..be966c0 100644 --- a/backend/views/module/list.php +++ b/backend/views/module/list.php @@ -4,69 +4,80 @@ * Date: 17.08.2018 */ -use core\entities\ModuleRecord; use yii\helpers\Html; use core\helpers\ModuleHelper; +use kartik\dialog\Dialog; /** * @var $this \yii\web\View * @var $modules \core\entities\ModuleRecord[] */ -$this->title = Yii::t('main', 'Modules'); +$this->title = Yii::t('main', 'Modules'); $this->params['breadcrumbs'][] = $this->title; + +$message = Yii::t('main', 'To remove the module, use the following command in the SSH console:'); +$js = <<php yii module/remove ' + name + ''); + }); +JS; +$this->registerJs($js, $this::POS_READY); ?> -
+ [], +]); +?> - +
- - $color = $module->isEnabled() ? '#00aced' : '#cccccc'; - if ($module->isDisabled()) { - ModuleHelper::addModuleAdminTranslation($module->name); - } + isEnabled() ? '#00aced' : '#cccccc'; + if ($module->isDisabled()) { + ModuleHelper::addModuleAdminTranslation($module->name); + } - $module_name = in_array($module->name, array_keys(Yii::$app->getI18n()->translations)) ? Yii::t($module->name, $module->name) : $module->name; - $module_description = in_array($module->name, array_keys(Yii::$app->getI18n()->translations)) ? Yii::t($module->name, $module->description) : $module->description; - ?> + $module_name = in_array($module->name, array_keys(Yii::$app->getI18n()->translations)) ? Yii::t($module->name, $module->name) : $module->name; + $module_description = in_array($module->name, array_keys(Yii::$app->getI18n()->translations)) ? Yii::t($module->name, $module->description) : $module->description; + ?> -
+
-
-
-

-
-
- -
- - + 'btn btn-danger btn-sm delete-button', + 'data-name' => $module->name, + ]) ?> +
+
+
+
diff --git a/backend/views/module/remote-list.php b/backend/views/module/remote-list.php index f2b6cfe..5b3fa91 100644 --- a/backend/views/module/remote-list.php +++ b/backend/views/module/remote-list.php @@ -5,6 +5,7 @@ */ use yii\helpers\Html; +use kartik\dialog\Dialog; /** * @var $this \yii\web\View @@ -14,12 +15,25 @@ use yii\helpers\Html; $this->title = Yii::t('main', 'Available Modules'); $this->params['breadcrumbs'][] = $this->title; + +$message = Yii::t('main', 'To install the module, use the following command in the SSH console:'); +$js = <<php yii module/install ' + name + ''); + }); +JS; +$this->registerJs($js, $this::POS_READY); ?> - +
+ [], + ]); +?>
@@ -43,18 +57,12 @@ $this->params['breadcrumbs'][] = $this->title;
diff --git a/console/migrations/m180914_163138_add_modules_system_field.php b/console/migrations/m180914_163138_add_modules_system_field.php new file mode 100644 index 0000000..8af2840 --- /dev/null +++ b/console/migrations/m180914_163138_add_modules_system_field.php @@ -0,0 +1,25 @@ +addColumn('{{%modules}}', 'system', $this->integer(1)->defaultValue(0)); + } + + /** + * {@inheritdoc} + */ + public function safeDown() + { + $this->dropColumn('{{%modules}}', 'system'); + } +}