Commit b53dc2b209f904b06ee718d1a9b7a1ed3b4d9d87
1 parent
7c229fe2
- bug fix
Showing
8 changed files
with
141 additions
and
61 deletions
Show diff stats
backend/views/settings/_contact_tab.php
| ... | ... | @@ -19,6 +19,7 @@ echo '<div class="wrapp-blocks-edit-page">'; |
| 19 | 19 | echo $form->field($model, 'phone2') |
| 20 | 20 | ->textInput() |
| 21 | 21 | ->hint(\Yii::t('core', 'Contact phone for website')); |
| 22 | + echo "<p>Введите несколько телефонов, разделенных ;</p>"; | |
| 22 | 23 | echo '</div>'; |
| 23 | 24 | echo '<div class="wrapp-blocks-edit-page">'; |
| 24 | 25 | echo $form->field($model, 'email') | ... | ... |
frontend/components/UrlManager.php
| ... | ... | @@ -65,6 +65,22 @@ |
| 65 | 65 | /** |
| 66 | 66 | * @var Alias $alias |
| 67 | 67 | */ |
| 68 | + if ($request->pathInfo === '') { | |
| 69 | + // Do redirect if no active alias for homepage | |
| 70 | + $seo = \Yii::$app->get('seo'); | |
| 71 | + $alias = Alias::findRoute([ 'site/index' ], $this->languages->getCurrent()); | |
| 72 | + if ($alias) { | |
| 73 | + $seo->setAlias($alias); | |
| 74 | + | |
| 75 | + $params = Json::decode($alias->route); | |
| 76 | + | |
| 77 | + $route = array_shift($params); | |
| 78 | + return [ | |
| 79 | + $route, | |
| 80 | + $params, | |
| 81 | + ]; | |
| 82 | + } | |
| 83 | + } | |
| 68 | 84 | $alias = Alias::find() |
| 69 | 85 | ->where( |
| 70 | 86 | [ | ... | ... |
frontend/config/main.php
| 1 | 1 | <?php |
| 2 | - use artbox\core\components\SeoComponent; | |
| 3 | 2 | use frontend\components\UrlManager; |
| 4 | 3 | |
| 5 | 4 | $params = array_merge( |
| ... | ... | @@ -66,20 +65,70 @@ |
| 66 | 65 | 'scenario' => 'callback', |
| 67 | 66 | 'successCallback' => 'function (data) { |
| 68 | 67 | document.getElementById("feedback-form").reset(); |
| 69 | - $(".close").click(); | |
| 68 | + $("#modal_close").click(); | |
| 70 | 69 | if (data.status == "success"){ |
| 71 | 70 | document.getElementById("feedback-form").reset(); |
| 72 | - $(".success_").animate({opacity: 1, top: \'40\'}, 200).addClass("done_"); | |
| 73 | - setTimeout(function(){$(".success_").animate({opacity: 0, top: \'0\'}, 200,function(){ | |
| 74 | - $(this).removeClass("done_"); | |
| 75 | - })}, 4000); | |
| 71 | + success(); | |
| 76 | 72 | var data = $("#feedback-form").data(\'yiiActiveForm\'); |
| 77 | 73 | data.validated = false; |
| 78 | 74 | } |
| 79 | 75 | }', |
| 80 | 76 | |
| 81 | 77 | ], |
| 78 | + 'contact' => [ | |
| 79 | + 'class' => 'artbox\core\forms\Module', | |
| 80 | + 'activeRecord' => "artbox\core\models\Feedback", | |
| 81 | + 'attributes' => [ | |
| 82 | + 'name', | |
| 83 | + 'email', | |
| 84 | + 'message', | |
| 85 | + ], | |
| 86 | + 'rules' => [ | |
| 87 | + [ | |
| 88 | + [ | |
| 89 | + 'name', | |
| 90 | + 'email', | |
| 91 | + ], | |
| 92 | + 'required', | |
| 93 | + ] | |
| 94 | + ], | |
| 95 | + 'labels' => [ | |
| 96 | + 'name' => 'Name', | |
| 97 | + 'message' => 'You Question', | |
| 98 | + 'phone' => 'Email' | |
| 99 | + ], | |
| 100 | + | |
| 101 | + 'inputOptions' => [ | |
| 102 | + 'name' => [ | |
| 103 | + 'template' => '<div class="input-wr required">{input}</div>' | |
| 104 | + ], | |
| 105 | + 'email' => [ | |
| 106 | + 'template' => '<div class="input-wr required">{input}</div>' | |
| 107 | + ], | |
| 108 | + 'message' => [ | |
| 109 | + 'type' => 'textarea', | |
| 110 | + 'options' => [], | |
| 111 | + 'template' => '<div class="input-wr">{input}</div>' | |
| 112 | + ], | |
| 113 | + ], | |
| 114 | + 'buttonTemplate' => '<div class="button-wr submit-close-wr-c-a">{button}</div>', | |
| 115 | + 'buttonOptions' => [], | |
| 116 | + 'buttonContent' => 'Send', | |
| 117 | + 'sendEmail' => false, | |
| 118 | + 'ajax' => true, | |
| 119 | + 'formId' => 'contact-form', | |
| 120 | + 'scenario' => 'feedback', | |
| 121 | + 'successCallback' => 'function (data) { | |
| 122 | + document.getElementById("contact-form").reset(); | |
| 123 | + if (data.status == "success"){ | |
| 124 | + document.getElementById("contact-form").reset(); | |
| 125 | + success(); | |
| 126 | + var data = $("#contact-form").data(\'yiiActiveForm\'); | |
| 127 | + data.validated = false; | |
| 128 | + } | |
| 129 | + }', | |
| 82 | 130 | |
| 131 | + ], | |
| 83 | 132 | 'comments' => [ |
| 84 | 133 | 'class' => 'artbox\core\forms\Module', |
| 85 | 134 | 'activeRecord' => "common\models\Comment", |
| ... | ... | @@ -305,9 +354,6 @@ |
| 305 | 354 | ], |
| 306 | 355 | ], |
| 307 | 356 | ], |
| 308 | - 'seo' => [ | |
| 309 | - 'class' => SeoComponent::className(), | |
| 310 | - ], | |
| 311 | 357 | 'errorHandler' => [ |
| 312 | 358 | 'errorAction' => 'site/error', |
| 313 | 359 | ], | ... | ... |
frontend/controllers/SiteController.php
| ... | ... | @@ -94,10 +94,12 @@ |
| 94 | 94 | public function actionContact() |
| 95 | 95 | { |
| 96 | 96 | $contact = new Feedback(); |
| 97 | + $settings = Settings::getInstance(); | |
| 97 | 98 | return $this->render( |
| 98 | 99 | 'contact', |
| 99 | 100 | [ |
| 100 | 101 | 'contact' => $contact, |
| 102 | + 'settings' => $settings | |
| 101 | 103 | ] |
| 102 | 104 | ); |
| 103 | 105 | } | ... | ... |
frontend/views/layouts/main.php
| ... | ... | @@ -24,6 +24,7 @@ |
| 24 | 24 | use frontend\widgets\LanguageWidget; |
| 25 | 25 | use frontend\widgets\Nav; |
| 26 | 26 | use yii\db\ActiveQuery; |
| 27 | + use yii\helpers\Html; | |
| 27 | 28 | use yii\web\View; |
| 28 | 29 | |
| 29 | 30 | AppAsset::register($this); |
| ... | ... | @@ -58,31 +59,42 @@ |
| 58 | 59 | 'content' => $seo->desc, |
| 59 | 60 | ] |
| 60 | 61 | ); |
| 62 | + | |
| 63 | + | |
| 64 | + $this->registerMetaTag( | |
| 65 | + [ | |
| 66 | + 'name' => 'robots', | |
| 67 | + 'content' => $seo->robots, | |
| 68 | + // 'content' => 'noindex,nofollow', | |
| 69 | + ] | |
| 70 | + ); | |
| 61 | 71 | $module = \Yii::$app->getModule('feedback'); |
| 62 | 72 | ?> |
| 63 | 73 | |
| 64 | 74 | <?php $this->beginPage() ?> |
| 65 | - <!DOCTYPE html> | |
| 66 | - <html xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html"> | |
| 75 | + <!DOCTYPE html > | |
| 76 | + <html xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html" lang="<?= \Yii::$app->language ?>"> | |
| 67 | 77 | <head> |
| 68 | - <title><?=$seo->title?></title> | |
| 69 | - <meta charset="utf-8"> | |
| 78 | + | |
| 79 | + <meta charset="<?= \Yii::$app->charset ?>"> | |
| 70 | 80 | <meta name="viewport" content="width=device-width"> |
| 71 | 81 | <link type="image/x-icon" href="favicon.ico" rel="icon"> |
| 82 | + <?= Html::csrfMetaTags() ?> | |
| 83 | + <title><?=Html::encode($seo->title)?></title> | |
| 72 | 84 | <?php $this->head() ?> |
| 73 | 85 | </head> |
| 74 | 86 | <body id="body"> |
| 75 | 87 | <?php $this->beginBody() ?> |
| 76 | - <!-- <div class="transition-loader">--> | |
| 77 | - <!-- <div class="transition-loader-inner">--> | |
| 78 | - <!-- <label></label>--> | |
| 79 | - <!-- <label></label>--> | |
| 80 | - <!-- <label></label>--> | |
| 81 | - <!-- <label></label>--> | |
| 82 | - <!-- <label></label>--> | |
| 83 | - <!-- <label></label>--> | |
| 84 | - <!-- </div>--> | |
| 85 | - <!-- </div>--> | |
| 88 | + <div class="transition-loader"> | |
| 89 | + <div class="transition-loader-inner"> | |
| 90 | + <label></label> | |
| 91 | + <label></label> | |
| 92 | + <label></label> | |
| 93 | + <label></label> | |
| 94 | + <label></label> | |
| 95 | + <label></label> | |
| 96 | + </div> | |
| 97 | + </div> | |
| 86 | 98 | <header id="header_" class="section-box-header"> |
| 87 | 99 | <div class="section-box-header-columns"> |
| 88 | 100 | <div class="container"> |
| ... | ... | @@ -135,11 +147,11 @@ |
| 135 | 147 | <li><a href="<?=Url::to(['site/questions'])?>">Вопрос-ответ</a></li> |
| 136 | 148 | <li><a href="<?=Url::to(['site/comments'])?>">Отзывы</a></li> |
| 137 | 149 | </ul> |
| 138 | - | |
| 139 | - <div class="lang-sep-wr hidden-xs hidden-sm"> | |
| 140 | - | |
| 141 | - <?= LanguageWidget::widget() ?> | |
| 142 | - </div> | |
| 150 | +<!-- --> | |
| 151 | +<!-- <div class="lang-sep-wr hidden-xs hidden-sm">--> | |
| 152 | +<!-- --> | |
| 153 | +<!-- --><?php //echo LanguageWidget::widget() ?> | |
| 154 | +<!-- </div>--> | |
| 143 | 155 | |
| 144 | 156 | <div class="hidden-sm hidden-md hidden-lg icon_phone-header-mob btn_call"></div> |
| 145 | 157 | ... | ... |
frontend/views/service/view.php
| ... | ... | @@ -15,7 +15,7 @@ |
| 15 | 15 | $this->params['entity_id'] = $model->id; |
| 16 | 16 | |
| 17 | 17 | $moduleComment = \Yii::$app->getModule('comments'); |
| 18 | - $this->params[ 'breadcrumbs' ][] = (!empty($seo->h1)) ? $seo->h1 :$model->title; | |
| 18 | + | |
| 19 | 19 | |
| 20 | 20 | $moduleComment->inputOptions = array_merge($moduleComment->inputOptions, ['entity_id' => [ |
| 21 | 21 | 'type' => 'hiddenInput', |
| ... | ... | @@ -31,6 +31,22 @@ |
| 31 | 31 | 'type' => 'hiddenInput', |
| 32 | 32 | 'options' => ['value' => $model->id], |
| 33 | 33 | ]]; |
| 34 | + if ($model->parent !== null){ | |
| 35 | + if ($model->parent->parent !== null){ | |
| 36 | + $this->params['breadcrumbs'][] = [ | |
| 37 | + 'label' => $model->parent->parent->title, | |
| 38 | + 'url' => Url::to(['alias' => $model->parent->parent->language->alias]), | |
| 39 | + ]; | |
| 40 | + } | |
| 41 | + $this->params['breadcrumbs'][] = [ | |
| 42 | + 'label' => $model->parent->title, | |
| 43 | + 'url' => Url::to(['alias' => $model->parent->language->alias]), | |
| 44 | + ]; | |
| 45 | + } | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + $this->params[ 'breadcrumbs' ][] = (!empty($seo->h1)) ? $seo->h1 :$model->title; | |
| 34 | 50 | ?> |
| 35 | 51 | <section class="section-service-page"> |
| 36 | 52 | <div class="container"> | ... | ... |
frontend/views/site/contact.php
| ... | ... | @@ -4,13 +4,11 @@ |
| 4 | 4 | * @var View $this |
| 5 | 5 | * @var Feedback $contact |
| 6 | 6 | * @var \artbox\core\forms\Module $module; |
| 7 | + * @var Settings $settings | |
| 7 | 8 | */ |
| 8 | 9 | |
| 9 | 10 | use artbox\core\models\Feedback; |
| 10 | 11 | use common\models\Settings; |
| 11 | - use frontend\assets\MapAsset; | |
| 12 | - use yii\helpers\Html; | |
| 13 | - use yii\bootstrap\ActiveForm; | |
| 14 | 12 | use yii\web\View; |
| 15 | 13 | |
| 16 | 14 | |
| ... | ... | @@ -20,8 +18,8 @@ |
| 20 | 18 | |
| 21 | 19 | |
| 22 | 20 | |
| 23 | -// | |
| 24 | -// $module = \Yii::$app->getModule('contact'); | |
| 21 | + | |
| 22 | + $module = \Yii::$app->getModule('contact'); | |
| 25 | 23 | ?> |
| 26 | 24 | |
| 27 | 25 | <section class="section-contact-page"> |
| ... | ... | @@ -35,18 +33,26 @@ |
| 35 | 33 | <div class="col-xs-12 col-sm-5 col-md-4 col-lg-4"> |
| 36 | 34 | <div class="style contacts-page-grey"> |
| 37 | 35 | <div class="map-info-wrapp"> |
| 36 | + <?php if (!empty($settings->address)){?> | |
| 38 | 37 | <div class="marker-img"><img src="/images/map/marker-1-grey.svg" width="12" height="18" alt=""></div> |
| 39 | - <div class="map-adress">Украина, Киев, ул. Кудрявская, 31/33</div> | |
| 38 | + <div class="map-adress"><?=$settings->address?></div> | |
| 39 | + <?php } ?> | |
| 40 | + <?php if (!empty($settings->phone) or !empty($settings->phone2)){ | |
| 41 | + $phones = explode(';', $settings->phone2) + [$settings->phone]; | |
| 42 | + ?> | |
| 40 | 43 | <div class="ico-map"><img src="/images/map/phone-map-1-grey.svg" alt=""></div> |
| 41 | 44 | <div class="map-phone"> |
| 42 | - <p>093 810-90-90</p> | |
| 43 | - <p>096 810-90-90</p> | |
| 44 | - <p>095 810-90-90</p> | |
| 45 | + <?php foreach ($phones as $phone){?> | |
| 46 | + <p><?=$phone?></p> | |
| 47 | + <?php }?> | |
| 45 | 48 | </div> |
| 49 | + <?php }?> | |
| 50 | + <?php if (!empty($settings->email)){?> | |
| 46 | 51 | <div class="ico-map ico-map-mail"><img src="/images/map/mail-map-1-grey.svg" alt=""></div> |
| 47 | 52 | <div class="map-mail"> |
| 48 | - <a href="mailto:abclinic@gmail.com">abclinic@gmail.com</a> | |
| 53 | + <a href="mailto:<?=$settings->email?>"><?=$settings->email?></a> | |
| 49 | 54 | </div> |
| 55 | + <?php } ?> | |
| 50 | 56 | </div> |
| 51 | 57 | </div> |
| 52 | 58 | </div> |
| ... | ... | @@ -55,26 +61,7 @@ |
| 55 | 61 | <div class="style blog-view-comments-form"> |
| 56 | 62 | <div class="style hidden-form-c-a"> |
| 57 | 63 | <div class="title-forms-c-a style">Обратный звонок</div> |
| 58 | - <form action=""> | |
| 59 | - <div class="input-wr required"> | |
| 60 | - <label class="control-label" for="feedback-name">ФИО</label> | |
| 61 | - <input type="text"> | |
| 62 | - </div> | |
| 63 | - | |
| 64 | - <div class="input-wr required"> | |
| 65 | - <label class="control-label" for="feedback-name">Email</label> | |
| 66 | - <input type="text"> | |
| 67 | - </div> | |
| 68 | - | |
| 69 | - <div class="input-wr"> | |
| 70 | - <label class="control-label" for="feedback-name">Ваш вопрос</label> | |
| 71 | - <textarea name="" id="" cols="30" rows="10"></textarea> | |
| 72 | - </div> | |
| 73 | - | |
| 74 | - <div class="button-wr submit-close-wr-c-a"> | |
| 75 | - <button type="submit">Отправить</button> | |
| 76 | - </div> | |
| 77 | - </form> | |
| 64 | + <?=$module->renderForm($this)?> | |
| 78 | 65 | </div> |
| 79 | 66 | </div> |
| 80 | 67 | </div> | ... | ... |
frontend/views/site/index.php
| ... | ... | @@ -7,13 +7,13 @@ |
| 7 | 7 | * @var \common\models\Comment[] $comments |
| 8 | 8 | * @var \common\models\Settings $settings |
| 9 | 9 | * @var \common\models\Package[] $package; |
| 10 | + * @var \artbox\core\components\SeoComponent $seo; | |
| 10 | 11 | */ |
| 11 | 12 | |
| 12 | 13 | use artbox\core\helpers\ImageHelper; |
| 13 | 14 | use artbox\core\helpers\Url; |
| 14 | 15 | use yii\web\View; |
| 15 | - | |
| 16 | - $this->title = 'My Yii Application'; | |
| 16 | + $seo = Yii::$app->get('seo'); | |
| 17 | 17 | \frontend\assets\ScrollAsset::register($this); |
| 18 | 18 | $js = <<<JS |
| 19 | 19 | //первый слайдер | ... | ... |