From 224032adce449d379343b1ddf85997c4ef61894d Mon Sep 17 00:00:00 2001 From: WebVPF <61043464+WebVPF@users.noreply.github.com> Date: Mon, 8 Jul 2024 16:26:54 +0300 Subject: [PATCH 1/3] Improved Russian translations (#1159) --- modules/cms/lang/ru/lang.php | 4 ++-- modules/system/lang/ru/lang.php | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/cms/lang/ru/lang.php b/modules/cms/lang/ru/lang.php index c3d02830a2..42505bf988 100644 --- a/modules/cms/lang/ru/lang.php +++ b/modules/cms/lang/ru/lang.php @@ -34,8 +34,8 @@ 'not_found' => 'Тема для редактирования не найдена.', 'not_match' => 'Объект, который вы пытаетесь открыть, не принадлежит редактируемой теме. Пожалуйста, обновите страницу.', ], - 'settings_menu' => 'Фронтенд темы', - 'settings_menu_description' => 'Управление темой интерфейса', + 'settings_menu' => 'Фронтенд тема', + 'settings_menu_description' => 'Управление и настройка параметров темы.', 'default_tab' => 'Свойства', 'name_label' => 'Название', 'name_create_placeholder' => 'Название новой темы', diff --git a/modules/system/lang/ru/lang.php b/modules/system/lang/ru/lang.php index 34489588cb..67c644f2e8 100644 --- a/modules/system/lang/ru/lang.php +++ b/modules/system/lang/ru/lang.php @@ -390,7 +390,7 @@ 'menu_description' => 'Просмотр системного журнала событий.', 'empty_link' => 'Очистить журнал событий', 'empty_loading'=> 'Очищение журнала событий...', - 'empty_success'=> 'Успешное очищение журнала событий.', + 'empty_success'=> 'Журнал событий очищен', 'return_link'=> 'Вернуться в журнал событий', 'id' => 'ID', 'id_label' => 'ID события', @@ -465,4 +465,10 @@ 'previous' => 'Предыдущий', 'next' => 'Следующий', ], + 'datetime' => [ + 'today' => 'Сегодня', + 'yesterday' => 'Вчера', + 'tomorrow' => 'Завтра', + 'at' => ':date в :time', + ], ]; From 347282b33fffad0d8f3d209e91754993bbfaf298 Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Thu, 11 Jul 2024 23:46:08 -0600 Subject: [PATCH 2/3] Added user:create command to create backend users from the CLI --- modules/backend/ServiceProvider.php | 2 +- modules/backend/console/UserCreate.php | 87 ++++++++++++++++++++++++++ 2 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 modules/backend/console/UserCreate.php diff --git a/modules/backend/ServiceProvider.php b/modules/backend/ServiceProvider.php index d300988aae..c81552de9d 100644 --- a/modules/backend/ServiceProvider.php +++ b/modules/backend/ServiceProvider.php @@ -55,7 +55,7 @@ protected function registerConsole() $this->registerConsoleCommand('create.controller', \Backend\Console\CreateController::class); $this->registerConsoleCommand('create.formwidget', \Backend\Console\CreateFormWidget::class); $this->registerConsoleCommand('create.reportwidget', \Backend\Console\CreateReportWidget::class); - + $this->registerConsoleCommand('user.create', \Backend\Console\UserCreate::class); $this->registerConsoleCommand('winter.passwd', \Backend\Console\WinterPasswd::class); } diff --git a/modules/backend/console/UserCreate.php b/modules/backend/console/UserCreate.php new file mode 100644 index 0000000000..2a9f5bfce1 --- /dev/null +++ b/modules/backend/console/UserCreate.php @@ -0,0 +1,87 @@ +Use the role\'s code} + {--f|force : Force the operation to run and ignore production warnings and confirmation questions.}'; + + /** + * @var string The console command description. + */ + protected $description = 'Creates a backend user.'; + + /** + * Execute the console command. + */ + public function handle(): int + { + $email = $this->argument('email'); + + if ( + Config::get('app.env', 'production') !== 'local' + && !$this->option('force') + && !$this->confirmWithInput("CAUTION, currently working with non-local data. Please confirm the user email address", $email) + ) { + return 1; + } + + if (User::where('email', $email)->exists()) { + $this->error('A user with that email already exists.'); + return 1; + } + + $data = [ + 'email' => $email, + 'password' => $this->option('password') ?: $this->secret('Password'), + 'first_name' => $this->option('fname') ?: $this->ask('First name', ''), + 'last_name' => $this->option('lname') ?: $this->ask('Last name', ''), + 'role_id' => ( + $role = UserRole::where( + 'code', + $this->option('role') ?: $this->choice( + 'Role', + UserRole::lists('name', 'code') + ) + )->firstOrFail() + )->id, + ]; + + $data['password_confirmation'] = $data['password']; + + $user = User::create([ + 'first_name' => $data['first_name'], + 'last_name' => $data['last_name'], + 'login' => $data['email'], + 'email' => $data['email'], + 'role_id' => $data['role_id'], + 'password' => $data['password'], + 'password_confirmation' => $data['password'], + ]); + + $this->info("User {$user->email} created successfully with the {$role->name} role."); + + return 0; + } +} From cb51ce9a2bfbd6cb951721b9e5705705e3250aa5 Mon Sep 17 00:00:00 2001 From: Ben Thomson Date: Sun, 14 Jul 2024 14:53:55 +0800 Subject: [PATCH 3/3] Add asset priority & use AssetMaker for global backend assets (#1022) Co-authored-by: Luke Towers Co-authored-by: Luke Towers This PR changes the global backend assets that were originally specified directly in the "head" template for the Backend, and uses the AssetMaker to load them instead. This should allow people the ability to manipulate the assets if need be through events. To ensure that the global assets are loaded first before all others, I have also introduced a order value for assets. It may be specified by providing the second argument for addJs(), addCss(), etc. as an array and populating it with the following: $this->addCss('my.css', [ 'build' => 'core', 'order' => 50, // must be an integer ]); The default order for all assets is 500. --- modules/backend/classes/Controller.php | 6 +- modules/backend/layouts/_head.php | 24 ++-- modules/backend/layouts/auth.php | 22 +-- .../system/tests/traits/AssetMakerTest.php | 62 ++++++-- modules/system/traits/AssetMaker.php | 132 ++++++++++-------- 5 files changed, 150 insertions(+), 96 deletions(-) diff --git a/modules/backend/classes/Controller.php b/modules/backend/classes/Controller.php index 9139ded692..bb413249fe 100644 --- a/modules/backend/classes/Controller.php +++ b/modules/backend/classes/Controller.php @@ -1,13 +1,13 @@ -pageTitle)) ?> | addCss($style, [ + 'build' => 'core', + 'order' => 1, + ]); +} // Scripts $scripts = [ @@ -49,18 +53,14 @@ Backend::skinAsset('assets/js/winter.flyout.js'), Backend::skinAsset('assets/js/winter.tabformexpandcontrols.js'), ]); +foreach ($scripts as $script) { + $this->addJs($script, [ + 'build' => 'core', + 'order' => 1, + ]); +} ?> - - - - - - - - - - - - -