Commit 543b9b1cb5946d68632c467b6ac5afd2020f0608

Authored by Yarik
1 parent 2612f958

Composer ready

Initializer.php
... ... @@ -1043,7 +1043,7 @@
1043 1043 if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
1044 1044 shell_exec("explorer '{$url}'");
1045 1045 } else {
1046   - shell_exec("sensible-browser {$url}");
  1046 + shell_exec("sensible-browser {$url} > /dev/null 2>/dev/null &");
1047 1047 $params = $this->getParams();
1048 1048 if (isset( $params[ 'fun' ] )) {
1049 1049 echo shell_exec("hollywood");
... ...
_composer.json 0 → 100644
  1 +{
  2 + "name": "artweb/artbox-basic",
  3 + "description": "Artbox Basic Project Template",
  4 + "keywords": [
  5 + "yii2",
  6 + "cms",
  7 + "artweb",
  8 + "artbox",
  9 + "basic",
  10 + "project template"
  11 + ],
  12 + "homepage": "http://artweb.ua",
  13 + "type": "project",
  14 + "license": "BSD-3-Clause",
  15 + "support": {
  16 + "wiki": "http://www.yiiframework.com/wiki/"
  17 + },
  18 + "minimum-stability": "dev",
  19 + "require": {
  20 + "php": ">=7.0",
  21 + "artweb/artbox-core": "*",
  22 + "yiisoft/yii2": "~2.0",
  23 + "yiisoft/yii2-bootstrap": "~2.0",
  24 + "yiisoft/yii2-swiftmailer": "~2.0",
  25 + "noam148/yii2-image-manager": "~1.0",
  26 + "yiister/yii2-gentelella": "~1.0",
  27 + "yii2tech/filedb": "~1.0",
  28 + "hiqdev/yii2-asset-pnotify": "~2.0",
  29 + "hiqdev/yii2-asset-icheck": "~1.0",
  30 + "google/apiclient": "^2.0"
  31 + },
  32 + "require-dev": {
  33 + "yiisoft/yii2-debug": "~2.0.0",
  34 + "yiisoft/yii2-gii": "~2.0.0",
  35 + "yiisoft/yii2-faker": "~2.0.0",
  36 + "codeception/base": "^2.2.3",
  37 + "codeception/verify": "~0.3.1"
  38 + },
  39 + "config": {
  40 + "process-timeout": 1800
  41 + },
  42 + "extra": {
  43 + "asset-installer-paths": {
  44 + "npm-asset-library": "vendor/npm",
  45 + "bower-asset-library": "vendor/bower"
  46 + }
  47 + },
  48 + "scripts": {
  49 + "post-install-cmd": "php init --env=Development --overwrite=n"
  50 + },
  51 + "autoload": {
  52 + "psr-4": {
  53 + "artbox\\core\\": "artweb/artbox-core/",
  54 + "artbox\\gentelella\\": "artweb/artbox-gentelella/"
  55 + }
  56 + }
  57 +}
... ...
backend/config/main.php
... ... @@ -38,11 +38,12 @@
38 38 'assetManager' => [
39 39 'bundles' => [
40 40 'yiister\gentelella\assets\ThemeAsset' => [
41   - 'sourcePath' => '@backend/assets/',
42   - 'js' => [
  41 + 'basePath' => '@webroot',
  42 + 'baseUrl' => '@web',
  43 + 'js' => [
43 44 'js/custom.js',
44 45 ],
45   - 'css' => [
  46 + 'css' => [
46 47 'css/custom.css',
47 48 ],
48 49 ],
... ...
backend/controllers/SettingsController.php
... ... @@ -2,7 +2,7 @@
2 2 namespace backend\controllers;
3 3  
4 4 use common\models\Settings;
5   - use Codeception\Exception\ConfigurationException;
  5 + use yii\base\InvalidConfigException;
6 6 use yii\filters\AccessControl;
7 7 use yii\web\Controller;
8 8 use Yii;
... ... @@ -14,7 +14,9 @@
14 14 */
15 15 class SettingsController extends Controller
16 16 {
17   -
  17 + /**
  18 + * @inheritdoc
  19 + */
18 20 public function behaviors()
19 21 {
20 22 return [
... ... @@ -41,13 +43,18 @@
41 43 ];
42 44 }
43 45 /**
44   - * @return bool|string
  46 + * @inheritdoc
45 47 */
46 48 public function getViewPath()
47 49 {
48 50 return \Yii::getAlias('@artbox/core/views/settings');
49 51 }
50   -
  52 +
  53 + /**
  54 + * Display site settings page
  55 + *
  56 + * @return string|\yii\web\Response
  57 + */
51 58 public function actionIndex()
52 59 {
53 60 $model = $this->findSettings();
... ... @@ -65,7 +72,13 @@
65 72 ]
66 73 );
67 74 }
68   -
  75 +
  76 + /**
  77 + * Find site settings
  78 + *
  79 + * @return \yii2tech\filedb\ActiveRecord
  80 + * @throws \yii\base\InvalidConfigException
  81 + */
69 82 public function findSettings()
70 83 {
71 84 if ($model = Settings::find()
... ... @@ -73,7 +86,8 @@
73 86 ) {
74 87 return $model;
75 88 } else {
76   - throw new ConfigurationException('Settings file not found');
  89 + throw new InvalidConfigException('Settings file not found');
77 90 }
78 91 }
79   - }
80 92 \ No newline at end of file
  93 + }
  94 +
81 95 \ No newline at end of file
... ...
backend/controllers/SiteController.php
1 1 <?php
2   -namespace backend\controllers;
3   -
4   -use Yii;
5   -use yii\web\Controller;
6   -use yii\filters\VerbFilter;
7   -use yii\filters\AccessControl;
8   -use common\models\LoginForm;
9   -
10   -/**
11   - * Site controller
12   - */
13   -class SiteController extends Controller
14   -{
  2 + namespace backend\controllers;
  3 +
  4 + use Yii;
  5 + use yii\web\Controller;
  6 + use yii\filters\VerbFilter;
  7 + use yii\filters\AccessControl;
  8 + use common\models\LoginForm;
  9 +
15 10 /**
16   - * @inheritdoc
  11 + * Site controller
17 12 */
18   - public function behaviors()
  13 + class SiteController extends Controller
19 14 {
20   - return [
21   - 'access' => [
22   - 'class' => AccessControl::className(),
23   - 'rules' => [
24   - [
25   - 'actions' => ['login', 'error'],
26   - 'allow' => true,
27   - ],
28   - [
29   - 'actions' => [
30   - 'logout',
31   - 'index',
32   - 'analytic',
  15 + /**
  16 + * @inheritdoc
  17 + */
  18 + public function behaviors()
  19 + {
  20 + return [
  21 + 'access' => [
  22 + 'class' => AccessControl::className(),
  23 + 'rules' => [
  24 + [
  25 + 'actions' => [
  26 + 'login',
  27 + 'error',
  28 + ],
  29 + 'allow' => true,
  30 + ],
  31 + [
  32 + 'actions' => [
  33 + 'logout',
  34 + 'index',
  35 + 'analytic',
  36 + ],
  37 + 'allow' => true,
  38 + 'roles' => [ '@' ],
33 39 ],
34   - 'allow' => true,
35   - 'roles' => ['@'],
36 40 ],
37 41 ],
38   - ],
39   - 'verbs' => [
40   - 'class' => VerbFilter::className(),
41   - 'actions' => [
42   - 'logout' => ['post'],
  42 + 'verbs' => [
  43 + 'class' => VerbFilter::className(),
  44 + 'actions' => [
  45 + 'logout' => [ 'post' ],
  46 + ],
43 47 ],
44   - ],
45   - ];
46   - }
47   -
48   - /**
49   - * @inheritdoc
50   - */
51   - public function actions()
52   - {
53   - return [
54   - 'error' => [
55   - 'class' => 'yii\web\ErrorAction',
56   - ],
57   - ];
58   - }
59   -
60   - /**
61   - * Displays homepage.
62   - *
63   - * @return string
64   - */
65   - public function actionIndex()
66   - {
67   - return $this->render('index');
68   - }
69   -
70   - /**
71   - * Login action.
72   - *
73   - * @return string
74   - */
75   - public function actionLogin()
76   - {
77   - if (!Yii::$app->user->isGuest) {
  48 + ];
  49 + }
  50 +
  51 + /**
  52 + * @inheritdoc
  53 + */
  54 + public function actions()
  55 + {
  56 + return [
  57 + 'error' => [
  58 + 'class' => 'yii\web\ErrorAction',
  59 + ],
  60 + ];
  61 + }
  62 +
  63 + /**
  64 + * Displays homepage.
  65 + *
  66 + * @return string
  67 + */
  68 + public function actionIndex()
  69 + {
  70 + return $this->render('index');
  71 + }
  72 +
  73 + /**
  74 + * Login action.
  75 + *
  76 + * @return string
  77 + */
  78 + public function actionLogin()
  79 + {
  80 + if (!Yii::$app->user->isGuest) {
  81 + return $this->goHome();
  82 + }
  83 +
  84 + $model = new LoginForm();
  85 + if ($model->load(Yii::$app->request->post()) && $model->login()) {
  86 + return $this->goBack();
  87 + } else {
  88 + return $this->renderPartial(
  89 + 'login',
  90 + [
  91 + 'model' => $model,
  92 + ]
  93 + );
  94 + }
  95 + }
  96 +
  97 + /**
  98 + * Logout action.
  99 + *
  100 + * @return string
  101 + */
  102 + public function actionLogout()
  103 + {
  104 + Yii::$app->user->logout();
  105 +
78 106 return $this->goHome();
79 107 }
80   -
81   - $model = new LoginForm();
82   - if ($model->load(Yii::$app->request->post()) && $model->login()) {
83   - return $this->goBack();
84   - } else {
85   - return $this->renderPartial('login', [
86   - 'model' => $model,
87   - ]);
  108 +
  109 + public function actionAnalytic()
  110 + {
  111 + return $this->renderPartial('analytic');
88 112 }
89 113 }
90   -
91   - /**
92   - * Logout action.
93   - *
94   - * @return string
95   - */
96   - public function actionLogout()
97   - {
98   - Yii::$app->user->logout();
99   -
100   - return $this->goHome();
101   - }
102   -
103   - public function actionAnalytic()
104   - {
105   - return $this->renderPartial('analytic');
106   - }
107   -}
... ...
backend/views/layouts/main.php
... ... @@ -7,25 +7,24 @@
7 7  
8 8 use artbox\core\assets\ArtboxCoreAsset;
9 9 use artbox\core\models\User;
  10 + use artbox\core\models\UserData;
10 11 use artbox\core\widgets\FeedbackWidget;
11 12 use artbox\core\widgets\FlashWidget;
12   - use hiqdev\assets\icheck\iCheckAsset;
13   - use hiqdev\assets\pnotify\PNotifyAsset;
14 13 use yii\bootstrap\Html;
15 14 use yii\web\UrlManager;
16 15 use yii\web\View;
17 16 use yii\widgets\Breadcrumbs;
18 17 use yiister\gentelella\widgets\Menu;
19 18  
20   - yiister\gentelella\assets\Asset::register($this);
21   - PNotifyAsset::register($this);
22 19 ArtboxCoreAsset::register($this);
23   - iCheckAsset::register($this);
24 20  
25 21 /**
26 22 * @var User $user
27 23 */
28 24 $user = \Yii::$app->user->identity;
  25 + /**
  26 + * @var UserData $userData
  27 + */
29 28 $userData = $user->ensureExistance();
30 29 ?>
31 30 <?php $this->beginPage(); ?>
... ...
backend/views/site/error.php
1 1 <?php
2   -
3   -/* @var $this yii\web\View */
4   -/* @var $name string */
5   -/* @var $message string */
6   -/* @var $exception Exception */
7   -
8   -use yii\helpers\Html;
9   -
10   -$this->title = $name;
  2 + use yii\helpers\Html;
  3 +
  4 + /**
  5 + * @var $this yii\web\View
  6 + * @var $name string
  7 + * @var $message string
  8 + * @var $exception Exception
  9 + */
  10 +
  11 + $this->title = $name;
11 12 ?>
12 13 <div class="site-error">
13   -
  14 +
14 15 <h1><?= Html::encode($this->title) ?></h1>
15   -
  16 +
16 17 <div class="alert alert-danger">
17 18 <?= nl2br(Html::encode($message)) ?>
18 19 </div>
19   -
  20 +
20 21 <p>
21 22 The above error occurred while the Web server was processing your request.
22 23 </p>
... ...
backend/views/site/login.php
... ... @@ -3,8 +3,10 @@
3 3 /**
4 4 * @var string $content
5 5 * @var \yii\web\View $this
  6 + * @var LoginForm $model
6 7 */
7 8  
  9 + use common\models\LoginForm;
8 10 use hiqdev\assets\icheck\iCheckAsset;
9 11 use yii\helpers\Html;
10 12 use yii\web\View;
... ... @@ -26,72 +28,68 @@ JS;
26 28 <?php $this->beginPage(); ?>
27 29 <!DOCTYPE html>
28 30 <html lang="<?= Yii::$app->language ?>">
29   -<head>
30   - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
31   - <meta charset="<?= Yii::$app->charset ?>"/>
32   - <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
33   - <meta name="viewport" content="width=device-width, initial-scale=1"/>
34   - <?= Html::csrfMetaTags() ?>
35   - <title><?= Html::encode($this->title) ?></title>
36   - <?php $this->head() ?>
37   - <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
38   - <!--[if lt IE 9]>
39   - <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
40   - <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
41   - <![endif]-->
42   -</head>
43   -<body>
44   -<?php $this->beginBody(); ?>
45   -<div class="container" style="background-color: #F7F7F7; height: 100%">
46   - <div class="row" style="margin-top: 10%">
47   - <div class="col-md-4 col-md-offset-4">
48   -
49   -
50   - <div class="site-login x_panel">
51   - <div class="x_title">
52   - <h1><?= Html::encode($this->title) ?></h1>
53   -
54   - <p>Please fill out the following fields to login:</p>
55   - </div>
56   - <div class="row">
57   - <div>
58   - <?php $form = ActiveForm::begin(
59   - [
60   - 'id' => 'login-form',
61   - 'validateOnBlur' => false,
62   - ]
63   - ); ?>
64   -
65   - <?= $form->field($model, 'username')
66   - ->textInput([ 'autofocus' => true ]) ?>
67   -
68   - <?= $form->field($model, 'password')
69   - ->passwordInput() ?>
70   -
71   - <?= $form->field($model, 'rememberMe')
72   - ->checkbox() ?>
73   -
74   - <div class="form-group">
75   - <?= Html::submitButton('Login',
76   - [
77   - 'class' => 'btn btn-default',
78   - 'name' => 'login-button',
79   - ]
80   - ) ?>
  31 + <head>
  32 + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  33 + <meta charset="<?= Yii::$app->charset ?>"/>
  34 + <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
  35 + <meta name="viewport" content="width=device-width, initial-scale=1"/>
  36 + <?= Html::csrfMetaTags() ?>
  37 + <title><?= Html::encode($this->title) ?></title>
  38 + <?php $this->head() ?>
  39 + </head>
  40 + <body>
  41 + <?php $this->beginBody(); ?>
  42 + <div class="container" style="background-color: #F7F7F7; height: 100%">
  43 + <div class="row" style="margin-top: 10%">
  44 + <div class="col-md-4 col-md-offset-4">
  45 +
  46 +
  47 + <div class="site-login x_panel">
  48 + <div class="x_title">
  49 + <h1><?= Html::encode($this->title) ?></h1>
  50 +
  51 + <p>Please fill out the following fields to login:</p>
  52 + </div>
  53 + <div class="row">
  54 + <div>
  55 + <?php $form = ActiveForm::begin(
  56 + [
  57 + 'id' => 'login-form',
  58 + 'validateOnBlur' => false,
  59 + ]
  60 + ); ?>
  61 +
  62 + <?= $form->field($model, 'username')
  63 + ->textInput([ 'autofocus' => true ]) ?>
  64 +
  65 + <?= $form->field($model, 'password')
  66 + ->passwordInput() ?>
  67 +
  68 + <?= $form->field($model, 'rememberMe')
  69 + ->checkbox() ?>
  70 +
  71 + <div class="form-group">
  72 + <?= Html::submitButton(
  73 + 'Login',
  74 + [
  75 + 'class' => 'btn btn-default',
  76 + 'name' => 'login-button',
  77 + ]
  78 + ) ?>
  79 + </div>
  80 +
  81 + <?php ActiveForm::end(); ?>
  82 + </div>
  83 + </div>
  84 + </div>
  85 +
  86 +
  87 + </div>
81 88 </div>
82   -
83   - <?php ActiveForm::end(); ?>
84   - </div>
  89 +
85 90 </div>
86   - </div>
87   -
88   -
89   - </div>
90   - </div>
91   -
92   -</div>
93   -<?php $this->endBody(); ?>
94   -</body>
  91 + <?php $this->endBody(); ?>
  92 + </body>
95 93 </html>
96 94 <?php $this->endPage(); ?>
97 95  
... ...
backend/assets/css/custom.css renamed to backend/web/css/custom.css
backend/assets/js/custom.js renamed to backend/web/js/custom.js
composer.json
1 1 {
2   - "name": "yiisoft/yii2-app-advanced",
3   - "description": "Yii 2 Advanced Project Template",
  2 + "name": "artweb/artbox-basic",
  3 + "description": "Artbox Basic Project Template",
4 4 "keywords": [
5 5 "yii2",
6   - "framework",
7   - "advanced",
  6 + "cms",
  7 + "artweb",
  8 + "artbox",
  9 + "basic",
8 10 "project template"
9 11 ],
10   - "homepage": "http://www.yiiframework.com/",
  12 + "homepage": "http://artweb.ua",
11 13 "type": "project",
12 14 "license": "BSD-3-Clause",
13 15 "support": {
14   - "issues": "https://github.com/yiisoft/yii2/issues?state=open",
15   - "forum": "http://www.yiiframework.com/forum/",
16   - "wiki": "http://www.yiiframework.com/wiki/",
17   - "irc": "irc://irc.freenode.net/yii",
18   - "source": "https://github.com/yiisoft/yii2"
  16 + "wiki": "http://www.yiiframework.com/wiki/"
19 17 },
20   - "minimum-stability": "stable",
  18 + "minimum-stability": "dev",
21 19 "require": {
22   - "php": ">=5.4.0",
23   - "yiisoft/yii2": "~2.0.6",
24   - "yiisoft/yii2-bootstrap": "~2.0.0",
25   - "yiisoft/yii2-swiftmailer": "~2.0.0",
26   - "insolita/yii2-migration-generator": "~2.2",
  20 + "php": ">=7.0",
  21 + "artweb/artbox-core": "*",
  22 + "yiisoft/yii2": "~2.0",
  23 + "yiisoft/yii2-bootstrap": "~2.0",
  24 + "yiisoft/yii2-swiftmailer": "~2.0",
  25 + "noam148/yii2-image-manager": "~1.0",
27 26 "yiister/yii2-gentelella": "~1.0",
28   - "hiqdev/yii2-asset-icheck": "1.0.2.5",
29   - "noam148/yii2-image-manager": "*",
30   - "yii2tech/filedb": "^1.0",
31   - "hiqdev/yii2-asset-pnotify": "^2.1",
32   - "yiisoft/yii2-imagine": "*",
33   - "2amigos/yii2-tinymce-widget": "*",
  27 + "yii2tech/filedb": "~1.0",
  28 + "hiqdev/yii2-asset-pnotify": "~2.0",
  29 + "hiqdev/yii2-asset-icheck": "~1.0",
34 30 "google/apiclient": "^2.0"
35 31 },
36 32 "require-dev": {
... ... @@ -50,12 +46,16 @@
50 46 }
51 47 },
52 48 "scripts": {
53   - "post-install-cmd": "php init --env=Development --overwrite=n"
  49 + "post-install-cmd": "php init --env=Development --overwrite=All --dbinit --dbtype=postgresql --dbname=artbox_basic --username=postgres --password=postgres --migrationPath=artweb/artbox-core/migrations --migrate=yes --defaultuser --checkdb"
54 50 },
55   - "autoload": {
56   - "psr-4": {
57   - "artbox\\core\\": "artweb/artbox-core/",
58   - "artbox\\gentelella\\": "artweb/artbox-gentelella/"
  51 + "repositories": [
  52 + {
  53 + "type": "vsc",
  54 + "url": "git@gitlab.artweb.com.ua:yarik.nechyporuk/artbox-core.git"
  55 + },
  56 + {
  57 + "type": "vsc",
  58 + "url": "git@gitlab.artweb.com.ua:yarik.nechyporuk/artbox-gentelella.git"
59 59 }
60   - }
  60 + ]
61 61 }
... ...