From 58728e08345123ea5e2c9d662ac0c02d90d25489 Mon Sep 17 00:00:00 2001 From: timur Date: Sun, 28 Jan 2018 16:16:19 +0200 Subject: [PATCH] объекты бэк правки и оформление на фронт --- backend/views/objectkb/_form_language.php | 8 -------- common/models/ObjectkbLang.php | 9 --------- common/models/ObjectkbSearch.php | 16 +++++++++------- console/migrations/m180128_105937_drop_meta_columns_from_object_lang_table.php | 29 +++++++++++++++++++++++++++++ frontend/assets/AppAsset.php | 4 ++-- frontend/controllers/BlogController.php | 3 ++- frontend/views/blog/_article_item.php | 8 ++++---- frontend/views/blog/index.php | 22 +++++++++++++++++++--- frontend/views/blog/view.php | 64 +++++++++++----------------------------------------------------- frontend/views/layouts/main.php | 994 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ frontend/views/object/index.php | 4 ++-- frontend/widgets/CategoryWidget.php | 20 ++++++++++++++++++++ frontend/widgets/SearchWidget.php | 19 +++++++++++++++++++ frontend/widgets/TagWidget.php | 20 ++++++++++++++++++++ frontend/widgets/views/category_view.php | 26 ++++++++++++++++++++++++++ frontend/widgets/views/search_view.php | 26 ++++++++++++++++++++++++++ frontend/widgets/views/tag_view.php | 27 +++++++++++++++++++++++++++ 17 files changed, 724 insertions(+), 575 deletions(-) create mode 100644 console/migrations/m180128_105937_drop_meta_columns_from_object_lang_table.php create mode 100644 frontend/widgets/CategoryWidget.php create mode 100644 frontend/widgets/SearchWidget.php create mode 100644 frontend/widgets/TagWidget.php create mode 100644 frontend/widgets/views/category_view.php create mode 100644 frontend/widgets/views/search_view.php create mode 100644 frontend/widgets/views/tag_view.php diff --git a/backend/views/objectkb/_form_language.php b/backend/views/objectkb/_form_language.php index df17bf7..2ca5a23 100755 --- a/backend/views/objectkb/_form_language.php +++ b/backend/views/objectkb/_form_language.php @@ -27,8 +27,6 @@ ) ->textInput([ 'maxlength' => true ]); - echo $form->field($model_lang, '[' . $language->id . ']h1') - ->textInput([ 'maxlength' => true ]); echo $form->field($model_lang, '[' . $language->id . ']upper_text') ->textarea([ 'rows' => 7 ]); @@ -36,10 +34,4 @@ echo $form->field($model_lang, '[' . $language->id . ']about_object_text') ->textarea([ 'rows' => 7 ]); - echo $form->field($model_lang, '[' . $language->id . ']meta_title') - ->textInput([ 'maxlength' => true ]); - - echo $form->field($model_lang, '[' . $language->id . ']meta_description') - ->textarea([ 'rows' => 4 ]); - ?> \ No newline at end of file diff --git a/common/models/ObjectkbLang.php b/common/models/ObjectkbLang.php index f440825..c861ca8 100755 --- a/common/models/ObjectkbLang.php +++ b/common/models/ObjectkbLang.php @@ -57,9 +57,6 @@ 'upper_text', 'about_object_text', 'object_name', - 'meta_title', - 'meta_description', - 'h1', ], 'required', ], @@ -76,9 +73,6 @@ 'upper_text', 'about_object_text', 'object_name', - 'meta_title', - 'meta_description', - 'h1', ], 'string', ], @@ -113,9 +107,6 @@ 'upper_text' => Yii::t('core', 'Upper Text'), 'about_object_text' => Yii::t('core', 'About object text'), 'object_name' => Yii::t('core', 'Object name'), - 'meta_title' => Yii::t('core', 'Meta Title'), - 'meta_description' => Yii::t('core', 'Meta Description'), - 'h1' => Yii::t('core', 'H1 tag'), ]; } diff --git a/common/models/ObjectkbSearch.php b/common/models/ObjectkbSearch.php index bac2bde..7a7f189 100644 --- a/common/models/ObjectkbSearch.php +++ b/common/models/ObjectkbSearch.php @@ -63,13 +63,15 @@ class ObjectkbSearch extends Objectkb } // grid filtering conditions - $query->andFilterWhere([ - 'id' => $this->id, - 'slider_id' => $this->slider_id, - 'status' => $this->status, - 'sort' => $this->sort, - 'image_mini_id' => $this->image_mini_id, - ]); + $query->andFilterWhere( + [ + 'id' => $this->id, + 'slider_id' => $this->slider_id, + 'status' => $this->status, + 'sort' => $this->sort, + 'image_mini_id' => $this->image_mini_id, + ] + ); return $dataProvider; } diff --git a/console/migrations/m180128_105937_drop_meta_columns_from_object_lang_table.php b/console/migrations/m180128_105937_drop_meta_columns_from_object_lang_table.php new file mode 100644 index 0000000..24aeece --- /dev/null +++ b/console/migrations/m180128_105937_drop_meta_columns_from_object_lang_table.php @@ -0,0 +1,29 @@ +dropColumn('object_lang', "meta_title"); + $this->dropColumn('object_lang', "meta_description"); + $this->dropColumn('object_lang', "h1"); + } + + /** + * @inheritdoc + */ + public function down() + { + $this->addColumn('object_lang', "meta_title", $this->string(50)); + $this->addColumn('object_lang', "meta_description", $this->string(300)); + $this->addColumn('object_lang', "h1", $this->string(50)); + } +} diff --git a/frontend/assets/AppAsset.php b/frontend/assets/AppAsset.php index 4055291..75e7f70 100644 --- a/frontend/assets/AppAsset.php +++ b/frontend/assets/AppAsset.php @@ -12,9 +12,9 @@ public $basePath = '@webroot'; public $baseUrl = '@web'; public $css = [ - 'css/site.css', +// 'css/site.css', 'css/animate.css', - 'css/style.css', +// 'css/style.css', 'css/style.blue.css', 'css/owl.carousel.css', 'css/owl.theme.css', diff --git a/frontend/controllers/BlogController.php b/frontend/controllers/BlogController.php index 537194c..937d7d0 100644 --- a/frontend/controllers/BlogController.php +++ b/frontend/controllers/BlogController.php @@ -24,7 +24,8 @@ [ 'status' => true, ] - ), + ) + ->orderBy("sort"), 'pagination' => [ 'pageSize' => 5, ], diff --git a/frontend/views/blog/_article_item.php b/frontend/views/blog/_article_item.php index ab67526..bb95c80 100644 --- a/frontend/views/blog/_article_item.php +++ b/frontend/views/blog/_article_item.php @@ -27,10 +27,10 @@
-

- By Николас - in NicolasBW -

+ + + +

diff --git a/frontend/views/blog/index.php b/frontend/views/blog/index.php index ec2f3c0..d346366 100644 --- a/frontend/views/blog/index.php +++ b/frontend/views/blog/index.php @@ -11,8 +11,17 @@ use yii\web\View; use yii\data\ActiveDataProvider; use yii\widgets\ListView; + use common\models\Settings; + use frontend\widgets\SearchWidget; + use frontend\widgets\CategoryWidget; + use frontend\widgets\TagWidget; - ?> + $settings = Settings::getInstance(); + + $this->params['h1'] = \Yii::t('app', 'menu-blog'); + $this->params[ 'breadcrumbs' ][] = $this->params['h1']; + +?>

@@ -33,8 +42,15 @@ )?>
- - + +
+ + + + + +
+
\ No newline at end of file diff --git a/frontend/views/blog/view.php b/frontend/views/blog/view.php index 30505a7..84847c0 100644 --- a/frontend/views/blog/view.php +++ b/frontend/views/blog/view.php @@ -8,6 +8,14 @@ */ use artbox\weblog\models\Article; + use frontend\widgets\SearchWidget; + use frontend\widgets\CategoryWidget; + use frontend\widgets\TagWidget; + use common\models\Settings; + + $settings = Settings::getInstance(); + + $this->params[ 'breadcrumbs' ][] = $this->title; ?> @@ -150,61 +158,11 @@ + - - - + - + diff --git a/frontend/views/layouts/main.php b/frontend/views/layouts/main.php index cd4108e..3e3b26e 100644 --- a/frontend/views/layouts/main.php +++ b/frontend/views/layouts/main.php @@ -39,7 +39,7 @@ 'lang', 'pages' => function (ActiveQuery $query) { $query->with('lang.alias') - ->where(['in_menu' => true]) + ->where([ 'in_menu' => true ]) ->orderBy([ 'sort' => SORT_ASC ]); }, ] @@ -64,511 +64,533 @@ ?> beginPage() ?> - - - - - - - - <?= Html::encode($seo->title) ?> - head() ?> - - - beginBody() ?> - - -
-
- - - - - - -phone)) { -// echo \Yii::t('app', 'Contact us on '); -// echo Html::a($settings->phone, \Yii::t('app', 'tel:')." {$settings->phone}"); -// if (!empty($settings->email)) { -// echo \Yii::t('app', ' or '); -// echo Html::a($settings->email, "mailto:$settings->email"); -// } -// } -// ?> - - - - - - - - -facebook)) { -// echo Html::a( -// Html::icon( -// 'facebook', -// [ -// 'prefix' => 'fa fa-', -// ] -// ), -// $settings->facebook, -// [ -// 'class' => 'external facebook', -// 'data' => [ -// 'animate-hover' => 'pulse', -// ], -// ] -// ); -// } -// ?> -vk)) { -// echo Html::a( -// Html::icon( -// 'vk', -// [ -// 'prefix' => 'fa fa-', -// ] -// ), -// $settings->vk, -// [ -// 'class' => 'external vk', -// 'data' => [ -// 'animate-hover' => 'pulse', -// ], -// ] -// ); -// } -// ?> -google)) { -// echo Html::a( -// Html::icon( -// 'google-plus', -// [ -// 'prefix' => 'fa fa-', -// ] -// ), -// $settings->google, -// [ -// 'class' => 'external gplus', -// 'data' => [ -// 'animate-hover' => 'pulse', -// ], -// ] -// ); -// } -// ?> -twitter)) { -// echo Html::a( -// Html::icon( -// 'twitter', -// [ -// 'prefix' => 'fa fa-', -// ] -// ), -// $settings->twitter, -// [ -// 'class' => 'external twitter', -// 'data' => [ -// 'animate-hover' => 'pulse', -// ], -// ] -// ); -// } -// ?> -ok)) { -// echo Html::a( -// Html::icon( -// 'odnoklassniki', -// [ -// 'prefix' => 'fa fa-', -// ] -// ), -// $settings->ok, -// [ -// 'class' => 'external odnoklassniki', -// 'data' => [ -// 'animate-hover' => 'pulse', -// ], -// ] -// ); -// } -// ?> -email)) { -// echo Html::a( -// Html::icon( -// 'envelope', -// [ -// 'prefix' => 'fa fa-', -// ] -// ), -// "mailto:$settings->email", -// [ -// 'class' => 'email', -// 'data' => [ -// 'animate-hover' => 'pulse', -// ], -// ] -// ); -// } -// ?> - - - - - - + + + + + + + + <?= Html::encode($seo->title) ?> + head() ?> + + + beginBody() ?> + + +
+
+ + + + + + + phone)) { + // echo \Yii::t('app', 'Contact us on '); + // echo Html::a($settings->phone, \Yii::t('app', 'tel:')." {$settings->phone}"); + // if (!empty($settings->email)) { + // echo \Yii::t('app', ' or '); + // echo Html::a($settings->email, "mailto:$settings->email"); + // } + // } + // ?> + + + + + + + + + facebook)) { + // echo Html::a( + // Html::icon( + // 'facebook', + // [ + // 'prefix' => 'fa fa-', + // ] + // ), + // $settings->facebook, + // [ + // 'class' => 'external facebook', + // 'data' => [ + // 'animate-hover' => 'pulse', + // ], + // ] + // ); + // } + // ?> + vk)) { + // echo Html::a( + // Html::icon( + // 'vk', + // [ + // 'prefix' => 'fa fa-', + // ] + // ), + // $settings->vk, + // [ + // 'class' => 'external vk', + // 'data' => [ + // 'animate-hover' => 'pulse', + // ], + // ] + // ); + // } + // ?> + google)) { + // echo Html::a( + // Html::icon( + // 'google-plus', + // [ + // 'prefix' => 'fa fa-', + // ] + // ), + // $settings->google, + // [ + // 'class' => 'external gplus', + // 'data' => [ + // 'animate-hover' => 'pulse', + // ], + // ] + // ); + // } + // ?> + twitter)) { + // echo Html::a( + // Html::icon( + // 'twitter', + // [ + // 'prefix' => 'fa fa-', + // ] + // ), + // $settings->twitter, + // [ + // 'class' => 'external twitter', + // 'data' => [ + // 'animate-hover' => 'pulse', + // ], + // ] + // ); + // } + // ?> + ok)) { + // echo Html::a( + // Html::icon( + // 'odnoklassniki', + // [ + // 'prefix' => 'fa fa-', + // ] + // ), + // $settings->ok, + // [ + // 'class' => 'external odnoklassniki', + // 'data' => [ + // 'animate-hover' => 'pulse', + // ], + // ] + // ); + // } + // ?> + email)) { + // echo Html::a( + // Html::icon( + // 'envelope', + // [ + // 'prefix' => 'fa fa-', + // ] + // ), + // "mailto:$settings->email", + // [ + // 'class' => 'email', + // 'data' => [ + // 'animate-hover' => 'pulse', + // ], + // ] + // ); + // } + // ?> + + + + + + + + + + - + + + +
+ + + - - -
- - -
- - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-

title; ?>

-
-
- isset($this->params[ 'breadcrumbs' ]) ? $this->params[ 'breadcrumbs' ] : [], - ] - ) ?> - -
-
-
-
- - - - - - - - - - + - 'btn btn-small btn-template-transparent-primary', - ] - ) ?> - - - - - + + + - - - - - - - - - - - - - endBody() ?> - - + + endBody() ?> + + endPage() ?> \ No newline at end of file diff --git a/frontend/views/object/index.php b/frontend/views/object/index.php index e40a4b7..9e86009 100644 --- a/frontend/views/object/index.php +++ b/frontend/views/object/index.php @@ -17,8 +17,8 @@ $settings = Settings::getInstance(); - $this->title = \Yii::t('app', 'menu-objects'); - $this->params[ 'breadcrumbs' ][] = $this->title; + $this->params['h1'] = \Yii::t('app', 'menu-objects'); + $this->params[ 'breadcrumbs' ][] = $this->params['h1']; ?>
diff --git a/frontend/widgets/CategoryWidget.php b/frontend/widgets/CategoryWidget.php new file mode 100644 index 0000000..4129480 --- /dev/null +++ b/frontend/widgets/CategoryWidget.php @@ -0,0 +1,20 @@ +render( + 'category_view' + ); + } + } + \ No newline at end of file diff --git a/frontend/widgets/SearchWidget.php b/frontend/widgets/SearchWidget.php new file mode 100644 index 0000000..9aff8de --- /dev/null +++ b/frontend/widgets/SearchWidget.php @@ -0,0 +1,19 @@ +render( + 'search_view' + ); + } + } \ No newline at end of file diff --git a/frontend/widgets/TagWidget.php b/frontend/widgets/TagWidget.php new file mode 100644 index 0000000..8e77eb0 --- /dev/null +++ b/frontend/widgets/TagWidget.php @@ -0,0 +1,20 @@ +render( + 'tag_view' + ); + } + } \ No newline at end of file diff --git a/frontend/widgets/views/category_view.php b/frontend/widgets/views/category_view.php new file mode 100644 index 0000000..cc01be3 --- /dev/null +++ b/frontend/widgets/views/category_view.php @@ -0,0 +1,26 @@ + + + diff --git a/frontend/widgets/views/search_view.php b/frontend/widgets/views/search_view.php new file mode 100644 index 0000000..93602c8 --- /dev/null +++ b/frontend/widgets/views/search_view.php @@ -0,0 +1,26 @@ + + + diff --git a/frontend/widgets/views/tag_view.php b/frontend/widgets/views/tag_view.php new file mode 100644 index 0000000..34a96b2 --- /dev/null +++ b/frontend/widgets/views/tag_view.php @@ -0,0 +1,27 @@ + + + -- libgit2 0.21.4