From 929c9486a0358e731b5f7494d9fe05bfb95844e8 Mon Sep 17 00:00:00 2001 From: dozer111 Date: Thu, 17 May 2018 10:48:39 +0200 Subject: [PATCH] Поредактировал формы, сообщения при корректном/некорректном заполнении , вывод дат formatter-а --- common/messages/en/app.php | 52 ++++++++++++++++++++++++++-------------------------- common/messages/ru/app.php | 56 +++++++++++++++++++++++--------------------------------- common/messages/ua/app.php | 64 +++++++++++++++++++++++++++++++++++----------------------------- frontend/assets/AppAsset.php | 1 + frontend/config/main.php | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------- frontend/controllers/SiteController.php | 4 ++-- frontend/models/FeedBack.php | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------- frontend/views/blog/_article.php | 3 ++- frontend/views/event/_event.php | 4 ++-- frontend/views/layouts/main.php | 6 +++--- frontend/views/site/contact.php | 2 +- frontend/web/js/script.js | 34 +++++++++++++++++++++++++++++++++- 12 files changed, 261 insertions(+), 170 deletions(-) diff --git a/common/messages/en/app.php b/common/messages/en/app.php index d891ff2..0c8e42c 100644 --- a/common/messages/en/app.php +++ b/common/messages/en/app.php @@ -9,32 +9,32 @@ return [ 'Categories' => 'Categories', 'Contact form' => "Contact form", 'Continue reading' => 'Continue reading', - 'Contact us!' => 'Contact us!', - 'Email'=>'Email', - 'Gallery'=>'Gallery', - 'Go to contact page' => 'Go to contact page', - 'Our clients'=>'Our clients', - 'No results found'=>'No results found', - 'Home'=>'Home', - 'Search'=>'Search', - 'Search by tag' => 'Search by tag', - "Search by article"=>'Search by article', - 'Send' => 'Send', - 'Send message' => 'Send message', - 'Events' => 'Events', - 'You question' => 'You question', - 'News' => 'News', - 'Media' => 'Media', - 'More' => 'More', - - 'Message' => 'Message', - 'Name' => 'Name', - 'Phone' => 'Phone', - - - - - + 'Contact us!' => 'Contact us!', + 'Email' =>'Email', + 'Gallery' =>'Gallery', + 'Go to contact page' => 'Go to contact page', + 'Our clients' =>'Our clients', + 'No results found' =>'No results found', + 'Home' =>'Home', + 'Search' =>'Search', + 'Search by tag' => 'Search by tag', + "Search by article" =>'Search by article', + 'Send' => 'Send', + 'Send message' => 'Send message', + 'Events' => 'Events', + 'You question' => 'You question', + 'News' => 'News', + 'Media' => 'Media', + 'More' => 'More', + 'Form sends success' => 'Form sends success', + 'Message' => 'Message', + 'Name' => 'Name', + 'Phone' => 'Phone', + 'Form sends success Header' => 'Success', + + + + 'phone' => 'phone', 'Without category'=>'Without category', 'Our advantages' => 'Our advantages', diff --git a/common/messages/ru/app.php b/common/messages/ru/app.php index 52b8524..9cb9bf6 100644 --- a/common/messages/ru/app.php +++ b/common/messages/ru/app.php @@ -6,40 +6,30 @@ return [ 'Blog' => 'Блог', 'Events' => 'Мероприятия', 'You question' => 'Ваш вопрос', - 'Send' => 'Отправить', 'Contact us!' => 'Свяжитесь с нами', - 'Go to contact page' => 'Перейти на страницу контактов', - 'Send message' => 'Отправить сообщение', - 'Contact form' => "Форма для связи", - 'News' => 'Новости', - 'Media' => 'Медиа', - 'More' => 'Подробнее', - 'Company Blog' => 'Блог компании', - - 'email'=>'Email 12345', - 'Email'=>'Email 12345', - 'Message' => 'Сообщения', - - 'Name' => 'Имя', - 'Phone' => 'Телефон', - - - - - 'blog-txt' => ' Мы собираем полезные материалы по тематике бытовой техники и электроники', - 'Continue reading' => 'Продолжить чтение', - 'Address' => 'Адрес', - 'phone' => 'Телефон', - - 'Gallery'=>'Галерея', - 'Categories' => 'Категории', - 'Without category'=>'Без категории', - 'No results found'=>'Ничего не найдено', - - - 'Our advantages' => 'Наши преимущества', - 'Our clients'=>'Наши клиенты', - + 'Go to contact page' => 'Перейти на страницу контактов', + 'Send message' => 'Отправить сообщение', + 'Contact form' => "Форма для связи", + 'News' => 'Новости', + 'Media' => 'Медиа', + 'More' => 'Подробнее', + 'Company Blog' => 'Блог компании', + 'Message' => 'Сообщения', + 'Name' => 'Имя', + 'Phone' => 'Телефон', + 'blog-txt' => ' Мы собираем полезные материалы по тематике бытовой техники и электроники', + 'Continue reading' => 'Продолжить чтение', + 'Address' => 'Адрес', + 'phone' => 'Телефон', + 'Form sends success' => 'Форма успешно отправлена', + 'Gallery' =>'Галерея', + 'Categories' => 'Категории', + 'Without category' =>'Без категории', + 'No results found' =>'Ничего не найдено', + 'Form sends success Header' => 'Форма успешно отправлена ', + 'Our advantages' => 'Наши преимущества', + 'Our clients' =>'Наши клиенты', + 'Send' => 'Отправить', "Search"=>'Поиск', 'Search by tag' => 'Поиск по тегам', diff --git a/common/messages/ua/app.php b/common/messages/ua/app.php index 250545e..a321d6e 100644 --- a/common/messages/ua/app.php +++ b/common/messages/ua/app.php @@ -1,40 +1,46 @@ 'Головна', - 'Contacts' => 'Контакти', - 'About' => 'Про нас', - 'Blog' => 'Блог', - 'Events' => 'Заходи', - 'Name' => 'Ім\'я', - 'Phone' => 'Телефон', - 'Message' => 'Повідомленя', - 'You question' => 'Ваше питання', - 'Send' => 'Відправити', - 'Contact us!' => 'Зв\'яжіться з нами', + 'Home' => 'Головна', + 'Contacts' => 'Контакти', + 'About' => 'Про нас', + 'Blog' => 'Блог', + 'Events' => 'Заходи', + 'Empty field' => 'Поле є обов\'язковим для заповнення', + 'Name' => 'Ім\'я', + 'Phone' => 'Телефон', + 'Message' => 'Повідомленя', + 'You question' => 'Ваше питання', + 'Send' => 'Відправити', + 'Contact us!' => 'Зв\'яжіться з нами', 'Go to contact page' => 'Перейти до сторінки контактів', - 'Читать далее' => 'Читати далі', - "Send message" => 'Надіслати повідомлення', - "Contact form" => 'Форма для зв\'язку', - 'News' => 'Новини', - 'Media' => 'Медіа', - 'More' => 'Докладніше', - 'Company Blog' => 'Блог компанії', - 'Categories' => 'Категорії', - 'blog-txt' => 'Ми збираємо корисні матеріали з тематики побутової техніки та електроніки', - 'Continue reading' => 'Продовжити читання', - 'Address' => 'Адреса', - 'phone' => 'телефон', - 'Gallery'=>'Галерея', - 'Without category'=>'Без категорії', - 'No results found'=>'Нічого не знайдено', - + 'Читать далее' => 'Читати далі', + "Send message" => 'Надіслати повідомлення', + "Contact form" => 'Форма для зв\'язку', + 'News' => 'Новини', + 'Media' => 'Медіа', + 'More' => 'Докладніше', + 'Company Blog' => 'Блог компанії', + 'Categories' => 'Категорії', + 'blog-txt' => 'Ми збираємо корисні матеріали з тематики побутової техніки та електроніки', + 'Continue reading' => 'Продовжити читання', + 'Address' => 'Адреса', + 'phone' => 'телефон', + 'Gallery' =>'Галерея', + 'Without category' =>'Без категорії', + 'No results found' =>'Нічого не знайдено', + 'Our advantages' => 'Наші переваги', 'Our clients'=>'Наші клієнти', - + 'Search'=>'Пошук', 'Search by tag' => 'Пошук по тегам', "Search by article"=>'Поиск по статтям', - + 'Form sends success Header' => 'Форма успішно відправлена', + 'name' => 'Ім\'я', + 'email' => 'Email', + 'message' => 'Повідомленя', + 'Form sends success' => 'Форма успішно відправлена ', + 'Wrong email' => 'Поле Email не валідне ', ]; \ No newline at end of file diff --git a/frontend/assets/AppAsset.php b/frontend/assets/AppAsset.php index a41bbd0..6aaace0 100755 --- a/frontend/assets/AppAsset.php +++ b/frontend/assets/AppAsset.php @@ -32,6 +32,7 @@ 'js/owl.carousel.min.js', 'js/script.js', 'js/modal.js', + 'js/jquery.mask.min.js', ]; public $depends = [ 'yii\web\YiiAsset', diff --git a/frontend/config/main.php b/frontend/config/main.php index 8a7ef8a..64a80b5 100755 --- a/frontend/config/main.php +++ b/frontend/config/main.php @@ -8,7 +8,6 @@ require( __DIR__ . '/params.php' ), require( __DIR__ . '/params-local.php' ) ); - return [ 'id' => 'app-frontend', 'homeUrl' => '/', @@ -20,6 +19,64 @@ 'artbox\core\services\Languages' =>'artbox\core\services\Languages', ] ], + + 'components' => [ + 'request' => [ + 'csrfParam' => '_csrf-frontend', + 'baseUrl' => '', + ], + + 'user' => [ + 'identityClass' => 'common\models\User', + 'enableAutoLogin' => true, + 'identityCookie' => [ + 'name' => '_identity-frontend', + 'httpOnly' => true, + ], + ], + 'session' => [ + // this is the name of the session cookie used for login on the frontend + 'name' => 'advanced-frontend', + ], + 'log' => [ + 'traceLevel' => YII_DEBUG ? 3 : 0, + 'targets' => [ + [ + 'class' => 'yii\log\FileTarget', + 'levels' => [ + 'error', + 'warning', + ], + ], + ], + ], + 'seo' => [ + 'class' => SeoComponent::className(), + ], + 'errorHandler' => [ + 'errorAction' => 'site/error', + ], + 'i18n' => [ + 'translations' => [ + 'core' => [ + 'class' => 'yii\i18n\PhpMessageSource', + 'basePath' => '@common/messages', + ], + 'app' => [ + 'class' => 'yii\i18n\PhpMessageSource', + 'basePath' => '@common/messages', + ], + ], + ], + 'urlManager' => [ + 'class' => UrlManager::className(), + 'baseUrl' => '/', + 'enablePrettyUrl' => true, + 'showScriptName' => false, + 'rules' => [ ], + 'hideDefaultLanguagePrefix' => true, + ], + ], 'modules' => [ 'feedback' => [ 'class' => 'artbox\core\forms\Module', @@ -77,7 +134,7 @@ 'name', 'email', 'phone', - 'message', + 'message', ], 'rules' => [ [ @@ -102,7 +159,7 @@ 'inputOptions' => [ 'name' => [ - 'template' => '
{input}
' + 'template' => '
{input}
', ], 'email' => [ 'template' => '
{input}
' @@ -118,9 +175,9 @@ ], 'buttonTemplate' => '
{button}
', 'buttonOptions' => [ - 'class' => 'btn btn-template-main', + 'class' => 'btn btn-template-main', ], - 'buttonContent' => '' .\Yii::t('app','Send message'), + 'buttonContent' => '' . \Yii::t('app', 'Message'), 'sendEmail' => false, 'ajax' => true, 'formId' => 'contact-form', @@ -133,66 +190,9 @@ $(this).removeClass("done_"); })}, 4000); }', - - ], - ], - 'components' => [ - 'request' => [ - 'csrfParam' => '_csrf-frontend', - 'baseUrl' => '', - ], - - 'user' => [ - 'identityClass' => 'common\models\User', - 'enableAutoLogin' => true, - 'identityCookie' => [ - 'name' => '_identity-frontend', - 'httpOnly' => true, - ], - ], - 'session' => [ - // this is the name of the session cookie used for login on the frontend - 'name' => 'advanced-frontend', - ], - 'log' => [ - 'traceLevel' => YII_DEBUG ? 3 : 0, - 'targets' => [ - [ - 'class' => 'yii\log\FileTarget', - 'levels' => [ - 'error', - 'warning', - ], - ], - ], - ], - 'seo' => [ - 'class' => SeoComponent::className(), - ], - 'errorHandler' => [ - 'errorAction' => 'site/error', - ], - 'i18n' => [ - 'translations' => [ - 'core' => [ - 'class' => 'yii\i18n\PhpMessageSource', - 'basePath' => '@common/messages', - ], - 'app' => [ - 'class' => 'yii\i18n\PhpMessageSource', - 'basePath' => '@common/messages', - ], - ], - ], - 'urlManager' => [ - 'class' => UrlManager::className(), - 'baseUrl' => '/', - 'enablePrettyUrl' => true, - 'showScriptName' => false, - 'rules' => [], - 'hideDefaultLanguagePrefix' => true, + ], ], - 'params' => $params, ]; + \ No newline at end of file diff --git a/frontend/controllers/SiteController.php b/frontend/controllers/SiteController.php index 192433f..6fabc06 100755 --- a/frontend/controllers/SiteController.php +++ b/frontend/controllers/SiteController.php @@ -1,7 +1,7 @@ self::SCENARIO_DEFAULT, + 'message' => \Yii::t('app', 'Empty field'), + ], + [ + [ + 'name', + 'email', + ], + 'required', + 'on' => self::SCENARIO_FEEDBACK, + 'message' => \Yii::t('app', 'Empty field'), + ], + [ + [ + 'phone', + 'name', + ], + 'required', + 'on' => self::SCENARIO_CALLBACK, + ], + [ + [ 'email' ], + 'email', + 'message' => 'Wrong email', + ], + + [ + [ + 'name', + 'phone', + 'email', + ], + 'string', + 'max' => 255, + ], + [ + [ + 'message', + ], + 'string', + ], + [ + [ + 'status', + ], + 'boolean', + ], + [ + 'returnUrl', + 'safe', + ], + ]; + } + } \ No newline at end of file diff --git a/frontend/views/blog/_article.php b/frontend/views/blog/_article.php index 6d6fe3d..235893f 100755 --- a/frontend/views/blog/_article.php +++ b/frontend/views/blog/_article.php @@ -58,7 +58,8 @@ } } ?>

- formatter->asDate($model->created_at); ?> + + formatter->asDate($model->created_at, 'short'); ?>

diff --git a/frontend/views/event/_event.php b/frontend/views/event/_event.php index ca125a6..5448f8b 100755 --- a/frontend/views/event/_event.php +++ b/frontend/views/event/_event.php @@ -59,8 +59,8 @@ } } ?>

- - formatter->asDate($model->created_at); ?> + + formatter->asDate($model->created_at, 'short'); ?>

diff --git a/frontend/views/layouts/main.php b/frontend/views/layouts/main.php index a077bd1..9f81a72 100755 --- a/frontend/views/layouts/main.php +++ b/frontend/views/layouts/main.php @@ -388,11 +388,11 @@ _________________________________________________________ -->