diff --git a/Vagrantfile b/Vagrantfile index 3bc9221..1474142 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -32,7 +32,7 @@ end # vagrant configurate Vagrant.configure(2) do |config| # select the box - config.vm.box = 'bento/ubuntu-16.04' + config.vm.box = 'bento/ubuntu-20.04' # should we ask about box updates? config.vm.box_check_update = options['box_check_update'] diff --git a/backend/assets/AdminLteSkinAsset.php b/backend/assets/AdminLteSkinAsset.php index 9fed12c..2e05a3e 100644 --- a/backend/assets/AdminLteSkinAsset.php +++ b/backend/assets/AdminLteSkinAsset.php @@ -6,7 +6,6 @@ namespace backend\assets; - use yii\web\AssetBundle; class AdminLteSkinAsset extends AssetBundle @@ -14,4 +13,4 @@ class AdminLteSkinAsset extends AssetBundle public $css = [ 'css/skin.css', ]; -} \ No newline at end of file +} diff --git a/backend/assets/AppAsset.php b/backend/assets/AppAsset.php index 02cd3fc..0a3f4cd 100644 --- a/backend/assets/AppAsset.php +++ b/backend/assets/AppAsset.php @@ -2,7 +2,10 @@ namespace backend\assets; +use yii\bootstrap\BootstrapAsset; +use yii\bootstrap\BootstrapPluginAsset; use yii\web\AssetBundle; +use yii\web\YiiAsset; /** * Main backend application asset bundle. @@ -12,12 +15,14 @@ class AppAsset extends AssetBundle public $basePath = '@webroot'; public $baseUrl = '@web'; public $css = [ - 'css/site.css', + 'css/site.css?v1.01', + 'css/ui.jqgrid-bootstrap.css' ]; public $js = [ ]; public $depends = [ - 'yii\web\YiiAsset', - 'yii\bootstrap\BootstrapPluginAsset', + YiiAsset::class, + BootstrapAsset::class, + BootstrapPluginAsset::class ]; } diff --git a/backend/bootstrap/SetUp.php b/backend/bootstrap/SetUp.php index b2c0d36..2977517 100644 --- a/backend/bootstrap/SetUp.php +++ b/backend/bootstrap/SetUp.php @@ -46,7 +46,7 @@ class SetUp implements BootstrapInterface // load settings $settings = Settings::find()->with('translations')->andWhere(['active' => 1])->all(); $settings_array = $settings ? ArrayHelper::map($settings, 'key', function ($el) { - return isset($el->translation->value) ? $el->translation->value : ''; + return $el->translation->value ?? ''; }, 'section') : []; $app->params['settings'] = $settings_array; diff --git a/backend/components/ToggleAction.php b/backend/components/ToggleAction.php index 808b348..121da47 100644 --- a/backend/components/ToggleAction.php +++ b/backend/components/ToggleAction.php @@ -7,59 +7,68 @@ namespace backend\components; use yii\base\Action; +use yii\base\ExitException; +use yii\db\ActiveRecord; use yii\db\Expression; use yii\base\InvalidConfigException; use yii\web\MethodNotAllowedHttpException; use Yii; +use yii\web\Response; class ToggleAction extends Action { /** * @var string name of the model */ - public $modelClass; + public string $modelClass; /** * @var string model attribute */ - public $attribute = 'active'; + public string $attribute = 'active'; /** * @var string scenario model */ - public $scenario = null; + public ?string $scenario = null; /** * @var string|array additional condition for loading the model */ - public $andWhere; + public string|array $andWhere; /** * @var string|int|boolean|Expression what to set active models to */ - public $onValue = 1; + public string|int|bool|Expression $onValue = 1; /** * @var string|int|boolean what to set inactive models to */ - public $offValue = 0; + public string|int|bool $offValue = 0; /** * @var bool whether to set flash messages or not */ - public $setFlash = false; + public bool $setFlash = false; /** * @var string flash message on success */ - public $flashSuccess = 'Model saved'; + public string $flashSuccess = 'Model saved'; /** * @var string flash message on error */ - public $flashError = 'Error saving Model'; + public string $flashError = 'Error saving Model'; /** * @var string|array URL to redirect to */ - public $redirect; + public string|array $redirect; /** * @var string pk field name */ - public $primaryKey = 'id'; - + public string $primaryKey = 'id'; + /** + * @param $id + * @return Response + * @throws InvalidConfigException + * @throws MethodNotAllowedHttpException + * @throws ExitException + */ public function run($id) { if (!Yii::$app->request->getIsPost()) { @@ -70,7 +79,7 @@ class ToggleAction extends Action if (empty($this->modelClass) || !class_exists($this->modelClass)) { throw new InvalidConfigException("Model class doesn't exist"); } - /* @var $modelClass \yii\db\ActiveRecord */ + /* @var $modelClass ActiveRecord */ $modelClass = $this->modelClass; $attribute = $this->attribute; $model = $modelClass::find()->where([$this->primaryKey => $id]); diff --git a/backend/components/ToggleColumn.php b/backend/components/ToggleColumn.php index 1576a72..0f09182 100644 --- a/backend/components/ToggleColumn.php +++ b/backend/components/ToggleColumn.php @@ -17,54 +17,54 @@ class ToggleColumn extends DataColumn * Toggle action that will be used as the toggle action in your controller * @var string */ - public $action = 'toggle'; + public string $action = 'toggle'; /** * @var string pk field name */ - public $primaryKey = 'primaryKey'; + public string $primaryKey = 'primaryKey'; /** * Whether to use ajax or not * @var bool */ - public $enableAjax = true; + public bool $enableAjax = true; /** * @var string glyphicon for 'on' value */ - public $iconOn = 'ok'; + public string $iconOn = 'ok'; /** * @var string glyphicon for 'off' value */ - public $iconOff = 'remove'; + public string $iconOff = 'remove'; /** - * @var string text to display on the 'on' link + * @var string|null text to display on the 'on' link */ - public $onText; + public ?string $onText = null; /** - * @var string text to display on the 'off' link + * @var string|null text to display on the 'off' link */ - public $offText; + public ?string $offText = null; /** - * @var string text to display next to the 'on' link + * @var string|bool text to display next to the 'on' link */ - public $displayValueText = false; + public string|bool $displayValueText = false; /** - * @var string text to display next to the 'on' link + * @var string|null text to display next to the 'on' link */ - public $onValueText; + public ?string $onValueText = null; /** - * @var string text to display next to the 'off' link + * @var string|null text to display next to the 'off' link */ - public $offValueText; + public ?string $offValueText = null; public function init() diff --git a/backend/components/menu/css/menu.css b/backend/components/menu/css/menu.css index 4949c9a..dd81d88 100644 --- a/backend/components/menu/css/menu.css +++ b/backend/components/menu/css/menu.css @@ -22,7 +22,7 @@ p { line-height: 1.5em; } position: relative; display: block; margin: 0; padding: 0; - max-width: 600px; + /*max-width: 600px;*/ list-style: none; font-size: 13px; line-height: 20px; @@ -43,7 +43,8 @@ p { line-height: 1.5em; } .dd-placeholder { display: block; position: relative; - margin: 0; padding: 1px; + margin: 0; + padding: 1px; min-height: 20px; font-size: 13px; line-height: 10px; @@ -134,7 +135,7 @@ p { line-height: 1.5em; } @media only screen and (min-width: 700px) { - .dd { float: left; width: 70%; } + .dd { float: left; width: 100%; } .dd + .dd { margin-left: 2%; } } @@ -167,9 +168,19 @@ p { line-height: 1.5em; } .dd-dragel > .dd3-item > .dd3-content { margin: 0; } -.dd3-item > button { margin-left: 30px; } +.dd3-item > button { + position: absolute; + margin-left: 30px; +} -.dd3-handle { position: absolute; margin: 0; left: 0; top: 0; cursor: pointer; width: 30px; text-indent: 100%; white-space: nowrap; overflow: hidden; +.dd3-handle { + position: absolute; + margin: 0; left: 0; top: 0; + cursor: pointer; + width: 30px; + /*text-indent: 100%;*/ + white-space: nowrap; + overflow: hidden; border: 1px solid #aaa; background: #ddd; background: -webkit-linear-gradient(top, #ddd 0%, #bbb 100%); @@ -179,8 +190,8 @@ p { line-height: 1.5em; } border-bottom-right-radius: 0; } .dd3-handle:before { - content: "\f047"; - font-family: FontAwesome; + content: "\f0b2"; + font-family: "Font Awesome 5 Free"; display: block; position: absolute; left: 0; top: 10px; @@ -189,16 +200,29 @@ p { line-height: 1.5em; } text-indent: 0; color: #fff; font-size: 15px; - font-weight: normal; + /*font-weight: normal;*/ } .dd3-handle:hover { background: #ddd; } -.panel-group { +.card-group { margin-bottom: 0 !important; } -.panel-heading { - position: relative; +.card-header { + position: relative !important; + color: #333333 !important; + background-color: #f5f5f5 !important; + border-color: #ddd !important; +} +.card-header h4 { + padding-left: 15px; + font-size: 16px; } -.panel-heading h4 { - padding-left: 25px; + +.card-header h4 a { + color: #333333; +} + +.menu-selector p, .menu-selector .form-group { + margin: 0 !important; + padding: 0 !important; } \ No newline at end of file diff --git a/backend/components/menu/widgets/MenuEditorWidget.php b/backend/components/menu/widgets/MenuEditorWidget.php index 7983f9e..93d1e62 100644 --- a/backend/components/menu/widgets/MenuEditorWidget.php +++ b/backend/components/menu/widgets/MenuEditorWidget.php @@ -12,9 +12,9 @@ use yii\base\Widget; class MenuEditorWidget extends Widget { - public $menu_id; + public int $menu_id; - public function run() + public function run(): string { $menu = Menu::findOne($this->menu_id); $items = $menu->items; @@ -26,14 +26,15 @@ class MenuEditorWidget extends Widget } /** - * @param $items MenuItem[] - * + * @param array $items + * @param null $paren_id * @return array */ - private function getMenu($items, $paren_id = null) + private function getMenu(array $items, $paren_id = null): array { $array = []; foreach ($items as $item) { + /* @var $item MenuItem */ if ($item->parent_id != $paren_id) { continue; } diff --git a/backend/components/menu/widgets/views/_item.php b/backend/components/menu/widgets/views/_item.php index c888c72..ad240e9 100644 --- a/backend/components/menu/widgets/views/_item.php +++ b/backend/components/menu/widgets/views/_item.php @@ -4,33 +4,44 @@ * Date: 11.07.2018 */ +use core\components\bootstrap4\widgets\Tab4; +use core\entities\menu\MenuItem; +use core\forms\menu\MenuItemForm; use yii\helpers\Html; use kartik\form\ActiveForm; +use yii\web\View; /** - * @var $this \yii\web\View + * @var $this View * @var $item array - * @var $model \core\forms\menu\MenuItemForm + * @var $model MenuItemForm */ -/* @var $menu_item \core\entities\menu\MenuItem */ +/* @var $menu_item MenuItem */ $menu_item = $item['item']; - ?> -
= Yii::t('menu', 'For template') ?>
+ += Yii::t('menu', 'For editor') ?>
+ +- = Html::a(Yii::t('user', 'Create Permission'), ['create'], ['class' => 'btn btn-success']) ?> -
- -- = Html::a(Yii::t('user', 'Permissions'), ['index'], ['class' => 'btn btn-default']) ?> - = Html::a(Yii::t('buttons', 'Edit'), ['update', 'id' => $model->name], ['class' => 'btn btn-primary']) ?> + = Html::a(Yii::t('user', 'Permissions'), ['index'], ['class' => 'btn btn-outline-primary btn-sm']) ?> + = Html::a(Yii::t('buttons', 'Edit'), ['update', 'id' => $model->name], ['class' => 'btn btn-primary btn-sm']) ?> = Html::a(Yii::t('buttons', 'Delete'), ['delete', 'id' => $model->name], [ - 'class' => 'btn btn-danger', + 'class' => 'btn btn-danger btn-sm', 'data' => [ 'confirm' => Yii::t('buttons', 'Are you sure you want to delete this item?'), 'method' => 'post', @@ -25,8 +25,8 @@ $this->params['breadcrumbs'][] = $this->title; ]) ?>
-- = Html::a(Yii::t('user', 'Create Role'), ['create'], ['class' => 'btn btn-success']) ?> -
- -- = Html::a(Yii::t('user', 'Roles'), ['index'], ['class' => 'btn btn-default']) ?> - = Html::a(Yii::t('buttons', 'Edit'), ['update', 'id' => $model->name], ['class' => 'btn btn-primary']) ?> + = Html::a(Yii::t('user', 'Roles'), ['index'], ['class' => 'btn btn-outline-primary btn-sm']) ?> + = Html::a(Yii::t('buttons', 'Edit'), ['update', 'id' => $model->name], ['class' => 'btn btn-primary btn-sm']) ?> = Html::a(Yii::t('buttons', 'Delete'), ['delete', 'id' => $model->name], [ - 'class' => 'btn btn-danger', + 'class' => 'btn btn-danger btn-sm', 'data' => [ 'confirm' => Yii::t('buttons', 'Are you sure you want to delete this item?'), 'method' => 'post', @@ -31,8 +34,8 @@ $this->params['breadcrumbs'][] = $this->title; ]) ?>
-- = Html::a(Yii::t('slider', 'Create Slide'), ['create'], ['class' => 'btn btn-success']) ?> -
- -- = Html::a(Yii::t('slider', 'Slider'), ['index'], ['class' => 'btn btn-default']) ?> - = Html::a(Yii::t('buttons', 'Edit'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?> + = Html::a(Yii::t('slider', 'Slider'), ['index'], ['class' => 'btn btn-outline-primary btn-sm']) ?> + = Html::a(Yii::t('buttons', 'Edit'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary btn-sm']) ?> = Html::a(Yii::t('buttons', 'Delete'), ['delete', 'id' => $model->id], [ - 'class' => 'btn btn-danger', + 'class' => 'btn btn-danger btn-sm', 'data' => [ 'confirm' => Yii::t('buttons', 'Are you sure you want to delete this item?'), 'method' => 'post', @@ -29,8 +28,8 @@ $this->params['breadcrumbs'][] = $this->title;
- = Html::a(Yii::t('user', 'Create User'), ['create'], ['class' => 'btn btn-success']) ?> -
- -- = Html::a(Yii::t('user', 'Users'), ['index'], ['class' => 'btn btn-default']) ?> - = Html::a(Yii::t('buttons', 'Edit'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?> + = Html::a(Yii::t('user', 'Users'), ['index'], ['class' => 'btn btn-outline-primary btn-sm']) ?> + = Html::a(Yii::t('buttons', 'Edit'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary btn-sm']) ?> = Html::a(Yii::t('buttons', 'Delete'), ['delete', 'id' => $model->id], [ - 'class' => 'btn btn-danger', + 'class' => 'btn btn-danger btn-sm', 'data' => [ 'confirm' => Yii::t('buttons', 'Are you sure you want to delete this item?'), 'method' => 'post', @@ -26,8 +27,8 @@ $this->params['breadcrumbs'][] = $this->title; ]) ?>
-- = Html::a(Yii::t('banners','Create Place'), ['create'], ['class' => 'btn btn-success']) ?> -
- -- = Html::a(Yii::t('languages','Create Language'), ['create'], ['class' => 'btn btn-success']) ?> -
- -- = Html::a(Yii::t('languages','Languages'), ['index'], ['class' => 'btn btn-default']) ?> - = Html::a(Yii::t('buttons', 'Edit'), ['update', 'id' => $language->id], ['class' => 'btn btn-primary']) ?> - = Html::a(Yii::t('buttons', 'Delete'), ['delete', 'id' => $language->id], [ - 'class' => 'btn btn-danger', - 'data' => [ - 'confirm' => Yii::t('buttons', 'Are you sure you want to delete this item?'), - 'method' => 'post', - ], - ]) ?> -
-