From b53dc2b209f904b06ee718d1a9b7a1ed3b4d9d87 Mon Sep 17 00:00:00 2001 From: Anastasia Date: Tue, 5 Jun 2018 15:46:27 +0300 Subject: [PATCH] - bug fix --- backend/views/settings/_contact_tab.php | 1 + frontend/components/UrlManager.php | 16 ++++++++++++++++ frontend/config/main.php | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--------- frontend/controllers/SiteController.php | 2 ++ frontend/views/layouts/main.php | 50 +++++++++++++++++++++++++++++++------------------- frontend/views/service/view.php | 18 +++++++++++++++++- frontend/views/site/contact.php | 47 +++++++++++++++++------------------------------ frontend/views/site/index.php | 4 ++-- 8 files changed, 141 insertions(+), 61 deletions(-) diff --git a/backend/views/settings/_contact_tab.php b/backend/views/settings/_contact_tab.php index e4916b7..502380a 100755 --- a/backend/views/settings/_contact_tab.php +++ b/backend/views/settings/_contact_tab.php @@ -19,6 +19,7 @@ echo '
'; echo $form->field($model, 'phone2') ->textInput() ->hint(\Yii::t('core', 'Contact phone for website')); + echo "

Введите несколько телефонов, разделенных ;

"; echo '
'; echo '
'; echo $form->field($model, 'email') diff --git a/frontend/components/UrlManager.php b/frontend/components/UrlManager.php index dd798d5..26faa46 100644 --- a/frontend/components/UrlManager.php +++ b/frontend/components/UrlManager.php @@ -65,6 +65,22 @@ /** * @var Alias $alias */ + if ($request->pathInfo === '') { + // Do redirect if no active alias for homepage + $seo = \Yii::$app->get('seo'); + $alias = Alias::findRoute([ 'site/index' ], $this->languages->getCurrent()); + if ($alias) { + $seo->setAlias($alias); + + $params = Json::decode($alias->route); + + $route = array_shift($params); + return [ + $route, + $params, + ]; + } + } $alias = Alias::find() ->where( [ diff --git a/frontend/config/main.php b/frontend/config/main.php index 37f78fa..35e61cf 100755 --- a/frontend/config/main.php +++ b/frontend/config/main.php @@ -1,5 +1,4 @@ 'callback', 'successCallback' => 'function (data) { document.getElementById("feedback-form").reset(); - $(".close").click(); + $("#modal_close").click(); if (data.status == "success"){ document.getElementById("feedback-form").reset(); - $(".success_").animate({opacity: 1, top: \'40\'}, 200).addClass("done_"); - setTimeout(function(){$(".success_").animate({opacity: 0, top: \'0\'}, 200,function(){ - $(this).removeClass("done_"); - })}, 4000); + success(); var data = $("#feedback-form").data(\'yiiActiveForm\'); data.validated = false; } }', ], + 'contact' => [ + 'class' => 'artbox\core\forms\Module', + 'activeRecord' => "artbox\core\models\Feedback", + 'attributes' => [ + 'name', + 'email', + 'message', + ], + 'rules' => [ + [ + [ + 'name', + 'email', + ], + 'required', + ] + ], + 'labels' => [ + 'name' => 'Name', + 'message' => 'You Question', + 'phone' => 'Email' + ], + + 'inputOptions' => [ + 'name' => [ + 'template' => '
{input}
' + ], + 'email' => [ + 'template' => '
{input}
' + ], + 'message' => [ + 'type' => 'textarea', + 'options' => [], + 'template' => '
{input}
' + ], + ], + 'buttonTemplate' => '
{button}
', + 'buttonOptions' => [], + 'buttonContent' => 'Send', + 'sendEmail' => false, + 'ajax' => true, + 'formId' => 'contact-form', + 'scenario' => 'feedback', + 'successCallback' => 'function (data) { + document.getElementById("contact-form").reset(); + if (data.status == "success"){ + document.getElementById("contact-form").reset(); + success(); + var data = $("#contact-form").data(\'yiiActiveForm\'); + data.validated = false; + } + }', + ], 'comments' => [ 'class' => 'artbox\core\forms\Module', 'activeRecord' => "common\models\Comment", @@ -305,9 +354,6 @@ ], ], ], - 'seo' => [ - 'class' => SeoComponent::className(), - ], 'errorHandler' => [ 'errorAction' => 'site/error', ], diff --git a/frontend/controllers/SiteController.php b/frontend/controllers/SiteController.php index 5c07822..022dedd 100755 --- a/frontend/controllers/SiteController.php +++ b/frontend/controllers/SiteController.php @@ -94,10 +94,12 @@ public function actionContact() { $contact = new Feedback(); + $settings = Settings::getInstance(); return $this->render( 'contact', [ 'contact' => $contact, + 'settings' => $settings ] ); } diff --git a/frontend/views/layouts/main.php b/frontend/views/layouts/main.php index b30b5ad..9976587 100755 --- a/frontend/views/layouts/main.php +++ b/frontend/views/layouts/main.php @@ -24,6 +24,7 @@ use frontend\widgets\LanguageWidget; use frontend\widgets\Nav; use yii\db\ActiveQuery; + use yii\helpers\Html; use yii\web\View; AppAsset::register($this); @@ -58,31 +59,42 @@ 'content' => $seo->desc, ] ); + + + $this->registerMetaTag( + [ + 'name' => 'robots', + 'content' => $seo->robots, + // 'content' => 'noindex,nofollow', + ] + ); $module = \Yii::$app->getModule('feedback'); ?> beginPage() ?> - - + + - <?=$seo->title?> - + + + + <?=Html::encode($seo->title)?> head() ?> beginBody() ?> - - - - - - - - - - +
+
+ + + + + + +
+
@@ -135,11 +147,11 @@
  • Вопрос-ответ
  • Отзывы
  • - - + + + + + diff --git a/frontend/views/service/view.php b/frontend/views/service/view.php index fe4c5d3..2aae552 100644 --- a/frontend/views/service/view.php +++ b/frontend/views/service/view.php @@ -15,7 +15,7 @@ $this->params['entity_id'] = $model->id; $moduleComment = \Yii::$app->getModule('comments'); - $this->params[ 'breadcrumbs' ][] = (!empty($seo->h1)) ? $seo->h1 :$model->title; + $moduleComment->inputOptions = array_merge($moduleComment->inputOptions, ['entity_id' => [ 'type' => 'hiddenInput', @@ -31,6 +31,22 @@ 'type' => 'hiddenInput', 'options' => ['value' => $model->id], ]]; + if ($model->parent !== null){ + if ($model->parent->parent !== null){ + $this->params['breadcrumbs'][] = [ + 'label' => $model->parent->parent->title, + 'url' => Url::to(['alias' => $model->parent->parent->language->alias]), + ]; + } + $this->params['breadcrumbs'][] = [ + 'label' => $model->parent->title, + 'url' => Url::to(['alias' => $model->parent->language->alias]), + ]; + } + + + + $this->params[ 'breadcrumbs' ][] = (!empty($seo->h1)) ? $seo->h1 :$model->title; ?>
    diff --git a/frontend/views/site/contact.php b/frontend/views/site/contact.php index 7a1acc6..51d7bf7 100755 --- a/frontend/views/site/contact.php +++ b/frontend/views/site/contact.php @@ -4,13 +4,11 @@ * @var View $this * @var Feedback $contact * @var \artbox\core\forms\Module $module; + * @var Settings $settings */ use artbox\core\models\Feedback; use common\models\Settings; - use frontend\assets\MapAsset; - use yii\helpers\Html; - use yii\bootstrap\ActiveForm; use yii\web\View; @@ -20,8 +18,8 @@ -// -// $module = \Yii::$app->getModule('contact'); + + $module = \Yii::$app->getModule('contact'); ?>
    @@ -35,18 +33,26 @@
    + address)){?>
    -
    Украина, Киев, ул. Кудрявская, 31/33
    +
    address?>
    + + phone) or !empty($settings->phone2)){ + $phones = explode(';', $settings->phone2) + [$settings->phone]; + ?>
    -

    093 810-90-90

    -

    096 810-90-90

    -

    095 810-90-90

    + +

    +
    + + email)){?>
    +
    @@ -55,26 +61,7 @@
    Обратный звонок
    -
    -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - -
    -
    + renderForm($this)?>
    diff --git a/frontend/views/site/index.php b/frontend/views/site/index.php index f443490..184623f 100755 --- a/frontend/views/site/index.php +++ b/frontend/views/site/index.php @@ -7,13 +7,13 @@ * @var \common\models\Comment[] $comments * @var \common\models\Settings $settings * @var \common\models\Package[] $package; + * @var \artbox\core\components\SeoComponent $seo; */ use artbox\core\helpers\ImageHelper; use artbox\core\helpers\Url; use yii\web\View; - - $this->title = 'My Yii Application'; + $seo = Yii::$app->get('seo'); \frontend\assets\ScrollAsset::register($this); $js = <<