Commit 929c9486a0358e731b5f7494d9fe05bfb95844e8

Authored by alex
1 parent 57b600d7

Поредактировал формы, сообщения при корректном/некорректном заполнении , вывод дат formatter-а

common/messages/en/app.php
@@ -9,32 +9,32 @@ return [ @@ -9,32 +9,32 @@ return [
9 'Categories' => 'Categories', 9 'Categories' => 'Categories',
10 'Contact form' => "Contact form", 10 'Contact form' => "Contact form",
11 'Continue reading' => 'Continue reading', 11 'Continue reading' => 'Continue reading',
12 - 'Contact us!' => 'Contact us!',  
13 - 'Email'=>'Email',  
14 - 'Gallery'=>'Gallery',  
15 - 'Go to contact page' => 'Go to contact page',  
16 - 'Our clients'=>'Our clients',  
17 - 'No results found'=>'No results found',  
18 - 'Home'=>'Home',  
19 - 'Search'=>'Search',  
20 - 'Search by tag' => 'Search by tag',  
21 - "Search by article"=>'Search by article',  
22 - 'Send' => 'Send',  
23 - 'Send message' => 'Send message',  
24 - 'Events' => 'Events',  
25 - 'You question' => 'You question',  
26 - 'News' => 'News',  
27 - 'Media' => 'Media',  
28 - 'More' => 'More',  
29 -  
30 - 'Message' => 'Message',  
31 - 'Name' => 'Name',  
32 - 'Phone' => 'Phone',  
33 -  
34 -  
35 -  
36 -  
37 - 12 + 'Contact us!' => 'Contact us!',
  13 + 'Email' =>'Email',
  14 + 'Gallery' =>'Gallery',
  15 + 'Go to contact page' => 'Go to contact page',
  16 + 'Our clients' =>'Our clients',
  17 + 'No results found' =>'No results found',
  18 + 'Home' =>'Home',
  19 + 'Search' =>'Search',
  20 + 'Search by tag' => 'Search by tag',
  21 + "Search by article" =>'Search by article',
  22 + 'Send' => 'Send',
  23 + 'Send message' => 'Send message',
  24 + 'Events' => 'Events',
  25 + 'You question' => 'You question',
  26 + 'News' => 'News',
  27 + 'Media' => 'Media',
  28 + 'More' => 'More',
  29 + 'Form sends success' => 'Form sends success',
  30 + 'Message' => 'Message',
  31 + 'Name' => 'Name',
  32 + 'Phone' => 'Phone',
  33 + 'Form sends success Header' => 'Success',
  34 +
  35 +
  36 +
  37 +
38 'phone' => 'phone', 38 'phone' => 'phone',
39 'Without category'=>'Without category', 39 'Without category'=>'Without category',
40 'Our advantages' => 'Our advantages', 40 'Our advantages' => 'Our advantages',
common/messages/ru/app.php
@@ -6,40 +6,30 @@ return [ @@ -6,40 +6,30 @@ return [
6 'Blog' => 'Блог', 6 'Blog' => 'Блог',
7 'Events' => 'Мероприятия', 7 'Events' => 'Мероприятия',
8 'You question' => 'Ваш вопрос', 8 'You question' => 'Ваш вопрос',
9 - 'Send' => 'Отправить',  
10 'Contact us!' => 'Свяжитесь с нами', 9 'Contact us!' => 'Свяжитесь с нами',
11 - 'Go to contact page' => 'Перейти на страницу контактов',  
12 - 'Send message' => 'Отправить сообщение',  
13 - 'Contact form' => "Форма для связи",  
14 - 'News' => 'Новости',  
15 - 'Media' => 'Медиа',  
16 - 'More' => 'Подробнее',  
17 - 'Company Blog' => 'Блог компании',  
18 -  
19 - 'email'=>'Email 12345',  
20 - 'Email'=>'Email 12345',  
21 - 'Message' => 'Сообщения',  
22 -  
23 - 'Name' => 'Имя',  
24 - 'Phone' => 'Телефон',  
25 -  
26 -  
27 -  
28 -  
29 - 'blog-txt' => ' Мы собираем полезные материалы по тематике бытовой техники и электроники',  
30 - 'Continue reading' => 'Продолжить чтение',  
31 - 'Address' => 'Адрес',  
32 - 'phone' => 'Телефон',  
33 -  
34 - 'Gallery'=>'Галерея',  
35 - 'Categories' => 'Категории',  
36 - 'Without category'=>'Без категории',  
37 - 'No results found'=>'Ничего не найдено',  
38 -  
39 -  
40 - 'Our advantages' => 'Наши преимущества',  
41 - 'Our clients'=>'Наши клиенты',  
42 - 10 + 'Go to contact page' => 'Перейти на страницу контактов',
  11 + 'Send message' => 'Отправить сообщение',
  12 + 'Contact form' => "Форма для связи",
  13 + 'News' => 'Новости',
  14 + 'Media' => 'Медиа',
  15 + 'More' => 'Подробнее',
  16 + 'Company Blog' => 'Блог компании',
  17 + 'Message' => 'Сообщения',
  18 + 'Name' => 'Имя',
  19 + 'Phone' => 'Телефон',
  20 + 'blog-txt' => ' Мы собираем полезные материалы по тематике бытовой техники и электроники',
  21 + 'Continue reading' => 'Продолжить чтение',
  22 + 'Address' => 'Адрес',
  23 + 'phone' => 'Телефон',
  24 + 'Form sends success' => 'Форма успешно отправлена',
  25 + 'Gallery' =>'Галерея',
  26 + 'Categories' => 'Категории',
  27 + 'Without category' =>'Без категории',
  28 + 'No results found' =>'Ничего не найдено',
  29 + 'Form sends success Header' => 'Форма успешно отправлена ',
  30 + 'Our advantages' => 'Наши преимущества',
  31 + 'Our clients' =>'Наши клиенты',
  32 + 'Send' => 'Отправить',
43 33
44 "Search"=>'Поиск', 34 "Search"=>'Поиск',
45 'Search by tag' => 'Поиск по тегам', 35 'Search by tag' => 'Поиск по тегам',
common/messages/ua/app.php
1 <?php 1 <?php
2 return [ 2 return [
3 - 'Home' => 'Головна',  
4 - 'Contacts' => 'Контакти',  
5 - 'About' => 'Про нас',  
6 - 'Blog' => 'Блог',  
7 - 'Events' => 'Заходи',  
8 - 'Name' => 'Ім\'я',  
9 - 'Phone' => 'Телефон',  
10 - 'Message' => 'Повідомленя',  
11 - 'You question' => 'Ваше питання',  
12 - 'Send' => 'Відправити',  
13 - 'Contact us!' => 'Зв\'яжіться з нами', 3 + 'Home' => 'Головна',
  4 + 'Contacts' => 'Контакти',
  5 + 'About' => 'Про нас',
  6 + 'Blog' => 'Блог',
  7 + 'Events' => 'Заходи',
  8 + 'Empty field' => 'Поле є обов\'язковим для заповнення',
  9 + 'Name' => 'Ім\'я',
  10 + 'Phone' => 'Телефон',
  11 + 'Message' => 'Повідомленя',
  12 + 'You question' => 'Ваше питання',
  13 + 'Send' => 'Відправити',
  14 + 'Contact us!' => 'Зв\'яжіться з нами',
14 'Go to contact page' => 'Перейти до сторінки контактів', 15 'Go to contact page' => 'Перейти до сторінки контактів',
15 - 'Читать далее' => 'Читати далі',  
16 - "Send message" => 'Надіслати повідомлення',  
17 - "Contact form" => 'Форма для зв\'язку',  
18 - 'News' => 'Новини',  
19 - 'Media' => 'Медіа',  
20 - 'More' => 'Докладніше',  
21 - 'Company Blog' => 'Блог компанії',  
22 - 'Categories' => 'Категорії',  
23 - 'blog-txt' => 'Ми збираємо корисні матеріали з тематики побутової техніки та електроніки',  
24 - 'Continue reading' => 'Продовжити читання',  
25 - 'Address' => 'Адреса',  
26 - 'phone' => 'телефон',  
27 - 'Gallery'=>'Галерея',  
28 - 'Without category'=>'Без категорії',  
29 - 'No results found'=>'Нічого не знайдено',  
30 - 16 + 'Читать далее' => 'Читати далі',
  17 + "Send message" => 'Надіслати повідомлення',
  18 + "Contact form" => 'Форма для зв\'язку',
  19 + 'News' => 'Новини',
  20 + 'Media' => 'Медіа',
  21 + 'More' => 'Докладніше',
  22 + 'Company Blog' => 'Блог компанії',
  23 + 'Categories' => 'Категорії',
  24 + 'blog-txt' => 'Ми збираємо корисні матеріали з тематики побутової техніки та електроніки',
  25 + 'Continue reading' => 'Продовжити читання',
  26 + 'Address' => 'Адреса',
  27 + 'phone' => 'телефон',
  28 + 'Gallery' =>'Галерея',
  29 + 'Without category' =>'Без категорії',
  30 + 'No results found' =>'Нічого не знайдено',
  31 +
31 'Our advantages' => 'Наші переваги', 32 'Our advantages' => 'Наші переваги',
32 'Our clients'=>'Наші клієнти', 33 'Our clients'=>'Наші клієнти',
33 - 34 +
34 'Search'=>'Пошук', 35 'Search'=>'Пошук',
35 'Search by tag' => 'Пошук по тегам', 36 'Search by tag' => 'Пошук по тегам',
36 "Search by article"=>'Поиск по статтям', 37 "Search by article"=>'Поиск по статтям',
37 -  
38 38
  39 + 'Form sends success Header' => 'Форма успішно відправлена',
  40 + 'name' => 'Ім\'я',
  41 + 'email' => 'Email',
  42 + 'message' => 'Повідомленя',
  43 + 'Form sends success' => 'Форма успішно відправлена ',
  44 + 'Wrong email' => 'Поле Email не валідне ',
39 45
40 ]; 46 ];
41 \ No newline at end of file 47 \ No newline at end of file
frontend/assets/AppAsset.php
@@ -32,6 +32,7 @@ @@ -32,6 +32,7 @@
32 'js/owl.carousel.min.js', 32 'js/owl.carousel.min.js',
33 'js/script.js', 33 'js/script.js',
34 'js/modal.js', 34 'js/modal.js',
  35 + 'js/jquery.mask.min.js',
35 ]; 36 ];
36 public $depends = [ 37 public $depends = [
37 'yii\web\YiiAsset', 38 'yii\web\YiiAsset',
frontend/config/main.php
@@ -8,7 +8,6 @@ @@ -8,7 +8,6 @@
8 require( __DIR__ . '/params.php' ), 8 require( __DIR__ . '/params.php' ),
9 require( __DIR__ . '/params-local.php' ) 9 require( __DIR__ . '/params-local.php' )
10 ); 10 );
11 -  
12 return [ 11 return [
13 'id' => 'app-frontend', 12 'id' => 'app-frontend',
14 'homeUrl' => '/', 13 'homeUrl' => '/',
@@ -20,6 +19,64 @@ @@ -20,6 +19,64 @@
20 'artbox\core\services\Languages' =>'artbox\core\services\Languages', 19 'artbox\core\services\Languages' =>'artbox\core\services\Languages',
21 ] 20 ]
22 ], 21 ],
  22 +
  23 + 'components' => [
  24 + 'request' => [
  25 + 'csrfParam' => '_csrf-frontend',
  26 + 'baseUrl' => '',
  27 + ],
  28 +
  29 + 'user' => [
  30 + 'identityClass' => 'common\models\User',
  31 + 'enableAutoLogin' => true,
  32 + 'identityCookie' => [
  33 + 'name' => '_identity-frontend',
  34 + 'httpOnly' => true,
  35 + ],
  36 + ],
  37 + 'session' => [
  38 + // this is the name of the session cookie used for login on the frontend
  39 + 'name' => 'advanced-frontend',
  40 + ],
  41 + 'log' => [
  42 + 'traceLevel' => YII_DEBUG ? 3 : 0,
  43 + 'targets' => [
  44 + [
  45 + 'class' => 'yii\log\FileTarget',
  46 + 'levels' => [
  47 + 'error',
  48 + 'warning',
  49 + ],
  50 + ],
  51 + ],
  52 + ],
  53 + 'seo' => [
  54 + 'class' => SeoComponent::className(),
  55 + ],
  56 + 'errorHandler' => [
  57 + 'errorAction' => 'site/error',
  58 + ],
  59 + 'i18n' => [
  60 + 'translations' => [
  61 + 'core' => [
  62 + 'class' => 'yii\i18n\PhpMessageSource',
  63 + 'basePath' => '@common/messages',
  64 + ],
  65 + 'app' => [
  66 + 'class' => 'yii\i18n\PhpMessageSource',
  67 + 'basePath' => '@common/messages',
  68 + ],
  69 + ],
  70 + ],
  71 + 'urlManager' => [
  72 + 'class' => UrlManager::className(),
  73 + 'baseUrl' => '/',
  74 + 'enablePrettyUrl' => true,
  75 + 'showScriptName' => false,
  76 + 'rules' => [ ],
  77 + 'hideDefaultLanguagePrefix' => true,
  78 + ],
  79 + ],
23 'modules' => [ 80 'modules' => [
24 'feedback' => [ 81 'feedback' => [
25 'class' => 'artbox\core\forms\Module', 82 'class' => 'artbox\core\forms\Module',
@@ -77,7 +134,7 @@ @@ -77,7 +134,7 @@
77 'name', 134 'name',
78 'email', 135 'email',
79 'phone', 136 'phone',
80 - 'message', 137 + 'message',
81 ], 138 ],
82 'rules' => [ 139 'rules' => [
83 [ 140 [
@@ -102,7 +159,7 @@ @@ -102,7 +159,7 @@
102 159
103 'inputOptions' => [ 160 'inputOptions' => [
104 'name' => [ 161 'name' => [
105 - 'template' => '<div class="col-sm-12">{input}</div>' 162 + 'template' => '<div class="col-sm-12">{input}</div>',
106 ], 163 ],
107 'email' => [ 164 'email' => [
108 'template' => '<div class="col-sm-6">{input}</div>' 165 'template' => '<div class="col-sm-6">{input}</div>'
@@ -118,9 +175,9 @@ @@ -118,9 +175,9 @@
118 ], 175 ],
119 'buttonTemplate' => '<div class="col-sm-12 text-center">{button}</div>', 176 'buttonTemplate' => '<div class="col-sm-12 text-center">{button}</div>',
120 'buttonOptions' => [ 177 'buttonOptions' => [
121 - 'class' => 'btn btn-template-main', 178 + 'class' => 'btn btn-template-main',
122 ], 179 ],
123 - 'buttonContent' => '<i class="fa fa-envelope-o"></i>' .\Yii::t('app','Send message'), 180 + 'buttonContent' => '<i class="fa fa-envelope-o"></i>' . \Yii::t('app', 'Message'),
124 'sendEmail' => false, 181 'sendEmail' => false,
125 'ajax' => true, 182 'ajax' => true,
126 'formId' => 'contact-form', 183 'formId' => 'contact-form',
@@ -133,66 +190,9 @@ @@ -133,66 +190,9 @@
133 $(this).removeClass("done_"); 190 $(this).removeClass("done_");
134 })}, 4000); 191 })}, 4000);
135 }', 192 }',
136 -  
137 - ],  
138 - ],  
139 - 'components' => [  
140 - 'request' => [  
141 - 'csrfParam' => '_csrf-frontend',  
142 - 'baseUrl' => '',  
143 - ],  
144 -  
145 - 'user' => [  
146 - 'identityClass' => 'common\models\User',  
147 - 'enableAutoLogin' => true,  
148 - 'identityCookie' => [  
149 - 'name' => '_identity-frontend',  
150 - 'httpOnly' => true,  
151 - ],  
152 - ],  
153 - 'session' => [  
154 - // this is the name of the session cookie used for login on the frontend  
155 - 'name' => 'advanced-frontend',  
156 - ],  
157 - 'log' => [  
158 - 'traceLevel' => YII_DEBUG ? 3 : 0,  
159 - 'targets' => [  
160 - [  
161 - 'class' => 'yii\log\FileTarget',  
162 - 'levels' => [  
163 - 'error',  
164 - 'warning',  
165 - ],  
166 - ],  
167 - ],  
168 - ],  
169 - 'seo' => [  
170 - 'class' => SeoComponent::className(),  
171 - ],  
172 - 'errorHandler' => [  
173 - 'errorAction' => 'site/error',  
174 - ],  
175 - 'i18n' => [  
176 - 'translations' => [  
177 - 'core' => [  
178 - 'class' => 'yii\i18n\PhpMessageSource',  
179 - 'basePath' => '@common/messages',  
180 - ],  
181 - 'app' => [  
182 - 'class' => 'yii\i18n\PhpMessageSource',  
183 - 'basePath' => '@common/messages',  
184 - ],  
185 - ],  
186 - ],  
187 - 'urlManager' => [  
188 - 'class' => UrlManager::className(),  
189 - 'baseUrl' => '/',  
190 - 'enablePrettyUrl' => true,  
191 - 'showScriptName' => false,  
192 - 'rules' => [],  
193 - 'hideDefaultLanguagePrefix' => true, 193 +
194 ], 194 ],
195 ], 195 ],
196 -  
197 'params' => $params, 196 'params' => $params,
198 ]; 197 ];
  198 +
199 \ No newline at end of file 199 \ No newline at end of file
frontend/controllers/SiteController.php
1 <?php 1 <?php
2 namespace frontend\controllers; 2 namespace frontend\controllers;
3 -  
4 - use artbox\core\models\Feedback; 3 +
  4 + use frontend\models\FeedBack;
5 use common\models\blog\Article; 5 use common\models\blog\Article;
6 use common\models\Settings; 6 use common\models\Settings;
7 use common\models\slider\Slide; 7 use common\models\slider\Slide;
frontend/models/FeedBack.php
1 <?php 1 <?php
2 /** 2 /**
3 - * Created by PhpStorm.  
4 - * User: user  
5 - * Date: 14.05.18  
6 - * Time: 13:25 3 + * ================================================================================================================|
  4 + * Модель для форм отзыва на openeurope
  5 + * ================================================================================================================|
7 */ 6 */
8 7
9 namespace frontend\models; 8 namespace frontend\models;
10 9
  10 +use artbox\core\models\Feedback as ArtboxCoreFeedback;
11 11
12 -  
13 -  
14 -class FeedBack 12 +class FeedBack extends ArtboxCoreFeedback
15 { 13 {
16 - 14 + public function rules()
  15 + {
  16 + return [
  17 + [
  18 + [
  19 + 'name',
  20 + 'email',
  21 + 'phone',
  22 + ],
  23 + 'required',
  24 + 'on' => self::SCENARIO_DEFAULT,
  25 + 'message' => \Yii::t('app', 'Empty field'),
  26 + ],
  27 + [
  28 + [
  29 + 'name',
  30 + 'email',
  31 + ],
  32 + 'required',
  33 + 'on' => self::SCENARIO_FEEDBACK,
  34 + 'message' => \Yii::t('app', 'Empty field'),
  35 + ],
  36 + [
  37 + [
  38 + 'phone',
  39 + 'name',
  40 + ],
  41 + 'required',
  42 + 'on' => self::SCENARIO_CALLBACK,
  43 + ],
  44 + [
  45 + [ 'email' ],
  46 + 'email',
  47 + 'message' => 'Wrong email',
  48 + ],
  49 +
  50 + [
  51 + [
  52 + 'name',
  53 + 'phone',
  54 + 'email',
  55 + ],
  56 + 'string',
  57 + 'max' => 255,
  58 + ],
  59 + [
  60 + [
  61 + 'message',
  62 + ],
  63 + 'string',
  64 + ],
  65 + [
  66 + [
  67 + 'status',
  68 + ],
  69 + 'boolean',
  70 + ],
  71 + [
  72 + 'returnUrl',
  73 + 'safe',
  74 + ],
  75 + ];
  76 + }
  77 +
17 } 78 }
18 \ No newline at end of file 79 \ No newline at end of file
frontend/views/blog/_article.php
@@ -58,7 +58,8 @@ @@ -58,7 +58,8 @@
58 } 58 }
59 } ?> 59 } ?>
60 <p class="date-comments"> 60 <p class="date-comments">
61 - <i class="fa fa-calendar-o"></i> <?= \Yii::$app->formatter->asDate($model->created_at); ?> 61 +
  62 + <i class="fa fa-calendar-o"></i> <?= \Yii::$app->formatter->asDate($model->created_at, 'short'); ?>
62 <!-- <a href="blog-post.html"><i class="fa fa-comment-o"></i> 8 комментариев</a>--> 63 <!-- <a href="blog-post.html"><i class="fa fa-comment-o"></i> 8 комментариев</a>-->
63 </p> 64 </p>
64 </div> 65 </div>
frontend/views/event/_event.php
@@ -59,8 +59,8 @@ @@ -59,8 +59,8 @@
59 } 59 }
60 } ?> 60 } ?>
61 <p class="date-comments"> 61 <p class="date-comments">
62 -  
63 - <i class="fa fa-calendar-o"></i> <?= \Yii::$app->formatter->asDate($model->created_at); ?> 62 +
  63 + <i class="fa fa-calendar-o"></i> <?= \Yii::$app->formatter->asDate($model->created_at, 'short'); ?>
64 <!-- <a href="blog-post.html"><i class="fa fa-comment-o"></i> 8 комментариев</a>--> 64 <!-- <a href="blog-post.html"><i class="fa fa-comment-o"></i> 8 комментариев</a>-->
65 </p> 65 </p>
66 </div> 66 </div>
frontend/views/layouts/main.php
@@ -388,11 +388,11 @@ _________________________________________________________ --&gt; @@ -388,11 +388,11 @@ _________________________________________________________ --&gt;
388 <div class="forms_wr_"> 388 <div class="forms_wr_">
389 <div class="modal-header"> 389 <div class="modal-header">
390 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times</button> 390 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times</button>
391 - <h3 class="modal-title" id="Success">Success</h3> 391 + <h3 class="modal-title" id="Success"><?= \Yii::t('app', 'Form sends success Header'); ?></h3>
392 </div> 392 </div>
393 <div class="modal-body"> 393 <div class="modal-body">
394 -  
395 - <p>Thank for your reply, we will call you, maybe.</p> 394 +
  395 + <p><?= \Yii::t('app', 'Form sends success') ?></p>
396 <p class="text-center"> 396 <p class="text-center">
397 <button type="button" class="btn btn-template-primary" data-dismiss="modal">Close</button> 397 <button type="button" class="btn btn-template-primary" data-dismiss="modal">Close</button>
398 </p> 398 </p>
frontend/views/site/contact.php
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 * @var \artbox\core\forms\Module $module; 6 * @var \artbox\core\forms\Module $module;
7 */ 7 */
8 8
9 - use artbox\core\models\Feedback; 9 + use frontend\models\Feedback;
10 use common\models\Settings; 10 use common\models\Settings;
11 use frontend\assets\MapAsset; 11 use frontend\assets\MapAsset;
12 use yii\helpers\Html; 12 use yii\helpers\Html;
frontend/web/js/script.js
1 $( 1 $(
2 function() { 2 function() {
3 - 3 + phoneMask('input[name="Feedback[phone]"]');
4 // /** 4 // /**
5 // * Modal form submit code 5 // * Modal form submit code
6 // */ 6 // */
@@ -103,5 +103,37 @@ $( @@ -103,5 +103,37 @@ $(
103 } 103 }
104 ); 104 );
105 } 105 }
  106 +
  107 + function phoneMask(maskCssSelector) {
  108 + var phoneInput = maskCssSelector;
  109 +
  110 + if ($('body')
  111 + .find(phoneInput).length > 0) {
  112 + $(phoneInput)
  113 + .mask('+38(000)000-00-00', {placeholder: '+38(000)000-00-00'});
  114 + $(phoneInput)
  115 + .focus(
  116 + function() {
  117 + if (($(this)
  118 + .val()) == '') {
  119 + $(this)
  120 + .val('+38(0')
  121 + }
  122 + }
  123 + );
  124 + $(phoneInput)
  125 + .focusout(
  126 + function() {
  127 + var phoneVal = $(this)
  128 + .val()
  129 + //if(phoneVal == '+38(0' || phoneVal == '+38(' || phoneVal == '+38' || phoneVal == '+3' || phoneVal == '+') {$(this).val('')}
  130 + if (phoneVal.length < 17) {
  131 + $(this)
  132 + .val('')
  133 + }
  134 + }
  135 + );
  136 + }
  137 + }
106 } 138 }
107 ); 139 );
108 \ No newline at end of file 140 \ No newline at end of file