diff --git a/backend/config/main.php b/backend/config/main.php index 2f069e2..0b7fcaf 100755 --- a/backend/config/main.php +++ b/backend/config/main.php @@ -23,6 +23,7 @@ 'alias' => 'artbox\core\controllers\AliasController', 'seo' => 'artbox\core\controllers\SeoController', 'feedback' => 'artbox\core\controllers\FeedbackController', + 'blog' => 'artbox\weblog\controllers\ArticleController', ], 'components' => [ 'assetManager' => [ diff --git a/backend/views/layouts/menu_items.php b/backend/views/layouts/menu_items.php index 59d585e..b72690c 100755 --- a/backend/views/layouts/menu_items.php +++ b/backend/views/layouts/menu_items.php @@ -88,5 +88,10 @@ 'url' => ['/objectkb/index'], 'icon' => 'bolt', ], + [ + 'label' => \Yii::t('core', 'Блог'), + 'url' => ['/blog/index'], + 'icon' => 'bolt', + ], ] ); \ No newline at end of file diff --git a/common/config/bootstrap.php b/common/config/bootstrap.php index 6828027..9dee74a 100644 --- a/common/config/bootstrap.php +++ b/common/config/bootstrap.php @@ -6,4 +6,7 @@ Yii::setAlias('@storage', dirname(dirname(__DIR__)) . '/storage'); if (!Yii::getAlias('@artbox/core', false)) { Yii::setAlias('@artbox/core', dirname(dirname(__DIR__)) . '/artweb/artbox-core'); + } + if (!Yii::getAlias('@artbox/weblog', false)) { + Yii::setAlias('@artbox/weblog', dirname(dirname(__DIR__)) . '/artweb/artbox-weblog'); } \ No newline at end of file diff --git a/common/config/main.php b/common/config/main.php index 2b684d8..5a0efdf 100644 --- a/common/config/main.php +++ b/common/config/main.php @@ -32,6 +32,10 @@ 'class' => 'yii\i18n\PhpMessageSource', 'basePath' => '@common/messages', ], + 'blog' => [ + 'class' => 'yii\i18n\PhpMessageSource', + 'basePath' => '@artbox/weblog/messages', + ], ], ], 'filedb' => [ diff --git a/composer.json b/composer.json index 89b1772..a0c0a79 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,8 @@ "speixoto/yii2-amcharts": "^0.1.1", "2amigos/yii2-tinymce-widget": "~1.1", "kartik-v/yii2-widget-select2": "@dev", - "artweb/artbox-core": "@dev" + "artweb/artbox-core": "@dev", + "artweb/artbox-weblog": "@dev" }, "require-dev": { "yiisoft/yii2-debug": "~2.0.0", @@ -53,6 +54,10 @@ { "type": "vcs", "url": "git@gitlab.artweb.com.ua:yarik.nechyporuk/artbox-core.git" + }, + { + "type": "vcs", + "url": "git@gitlab.artweb.com.ua:Alexey/artbox-weblog.git" } ] } diff --git a/frontend/config/main.php b/frontend/config/main.php index a5e09ea..5756b14 100644 --- a/frontend/config/main.php +++ b/frontend/config/main.php @@ -51,7 +51,7 @@ return [ ], 'processRoutes' => [ 'object/view', -// 'blog/article', + 'blog/article', // 'blog/tag', // 'blog/category', ], diff --git a/frontend/controllers/BlogController.php b/frontend/controllers/BlogController.php new file mode 100644 index 0000000..537194c --- /dev/null +++ b/frontend/controllers/BlogController.php @@ -0,0 +1,79 @@ + Article::find() + ->where( + [ + 'status' => true, + ] + ), + 'pagination' => [ + 'pageSize' => 5, + ], + ] + ); + + return $this->render( + 'index', + [ + 'dataProvider' => $dataProvider, + ] + ); + } + + public function actionArticle($id) + { + + $model = $this->findModel($id); + + return $this->render( + 'view', + [ + 'article' => $model, + ] + ); + + } + + protected function findModel($id) + { + /** + * Some comment + */ + + $model = Article::find() + ->where( + [ + 'id' => $id + ] + ) + ->with("lang") + ->one(); + + if ( $model !== NULL) { + return $model; + } + else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } + + } \ No newline at end of file diff --git a/frontend/controllers/ObjectController.php b/frontend/controllers/ObjectController.php index 31455b5..9b42958 100644 --- a/frontend/controllers/ObjectController.php +++ b/frontend/controllers/ObjectController.php @@ -13,6 +13,24 @@ class ObjectController extends Controller { + + public function actionIndex() + { + + $objects = Objectkb::find() + ->where(['status'=>true]) + ->with("lang.alias") + ->with("image") + ->all(); + + return $this->render( + 'index', + [ + 'objects' => $objects, + ] + ); + } // наши объекты + public function actionView($id) { diff --git a/frontend/controllers/SiteController.php b/frontend/controllers/SiteController.php index 9ccde5f..37fa64c 100644 --- a/frontend/controllers/SiteController.php +++ b/frontend/controllers/SiteController.php @@ -100,23 +100,6 @@ return $this->render('legal'); } // юридическое - public function actionObjects() - { - - $objects = Objectkb::find() - ->where(['status'=>true]) - ->with("lang.alias") - ->with("image") - ->all(); - - return $this->render( - 'objects', - [ - 'objects' => $objects, - ] - ); - } // наши объекты - public function actionGreen() { return $this->render('green'); diff --git a/frontend/views/blog/_article_item.php b/frontend/views/blog/_article_item.php new file mode 100644 index 0000000..ab67526 --- /dev/null +++ b/frontend/views/blog/_article_item.php @@ -0,0 +1,75 @@ + + +
+

+ + lang->title?> + +

+
+
+

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

+
+ +
+
+ + image->getImg( + [ + 'class' => "img-responsive" + ] + )?> + + +
+

+ lang->body_preview?> +

+

+ + Читать далее + +

+
diff --git a/frontend/views/blog/index.php b/frontend/views/blog/index.php new file mode 100644 index 0000000..ec2f3c0 --- /dev/null +++ b/frontend/views/blog/index.php @@ -0,0 +1,40 @@ + + +
+
+
+ +
+ + $dataProvider, + 'itemView' => '_article_item', + 'layout' => '{items}{pager}', + 'pager' => [ + 'disableCurrentPageButton' => true, + 'registerLinkTags' => true, + ], + ] + )?> + +
+ + +
+
+
\ No newline at end of file diff --git a/frontend/views/blog/view.php b/frontend/views/blog/view.php new file mode 100644 index 0000000..03168c7 --- /dev/null +++ b/frontend/views/blog/view.php @@ -0,0 +1,224 @@ + + +
+
+ +
+ + + +
+ + +

By copywriter in TravelBlog

+ +

+ lang->title?> +

+ +
+

+ Лофотенский архипелаг расположен в Норвежском море. Он представляет собой скалистые острова, разделенные узкими проливами с дикими бухтами, песчаными пляжами и чистейшей водой. +

+ +

+ image->getImg( + [ + 'class' => "img-responsive" + ] + )?> + +

+ + lang->body?> + +
+ + + + + + + + + + + + + + + + + + + + +--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +
+ + + + + + + + + + + + +
+ + + + + +
+ + +
+ +
diff --git a/frontend/views/layouts/main.php b/frontend/views/layouts/main.php index f964a5e..2283f04 100644 --- a/frontend/views/layouts/main.php +++ b/frontend/views/layouts/main.php @@ -307,7 +307,7 @@ _________________________________________________________ --> ]; $items[] = [ 'label' => \Yii::t('app', 'menu-objects'), - 'url' => [ 'site/objects' ], + 'url' => [ 'object/index' ], ]; $items[] = [ 'label' => \Yii::t('app', 'menu-green'), @@ -319,7 +319,7 @@ _________________________________________________________ --> ]; $items[] = [ 'label' => \Yii::t('app', 'menu-blog'), - 'url' => [ 'site/blog' ], + 'url' => [ 'blog/index' ], ]; $items[] = [ 'label' => \Yii::t('app', 'menu-contacts'), diff --git a/frontend/views/object/index.php b/frontend/views/object/index.php new file mode 100644 index 0000000..aa2ecf4 --- /dev/null +++ b/frontend/views/object/index.php @@ -0,0 +1,93 @@ +title = \Yii::t('app', 'menu-objects'); + $this->params[ 'breadcrumbs' ][] = $this->title; +?> + +
+
+
+ +
+ +
+
+ +

Туристическое агентство “WhereAreYou” осуществляет нестандартные поездки с 2003 года. Мы занимаемся не просто путешествием, а для каждого лично составляем полноценный план поездки: что лучше посетить, длительность пребывания исходя из ваших средств. Все что требуется от вас — назвать город, страну и бюджет.

+
+
+ +
+ + +
+
+
+ image->getImg([]) ?> +
+
+ + +
+
+ + +
+ + +
+ +
+
+
\ No newline at end of file diff --git a/frontend/views/site/objects.php b/frontend/views/site/objects.php deleted file mode 100644 index aa2ecf4..0000000 --- a/frontend/views/site/objects.php +++ /dev/null @@ -1,93 +0,0 @@ -title = \Yii::t('app', 'menu-objects'); - $this->params[ 'breadcrumbs' ][] = $this->title; -?> - -
-
-
- -
- -
-
- -

Туристическое агентство “WhereAreYou” осуществляет нестандартные поездки с 2003 года. Мы занимаемся не просто путешествием, а для каждого лично составляем полноценный план поездки: что лучше посетить, длительность пребывания исходя из ваших средств. Все что требуется от вас — назвать город, страну и бюджет.

-
-
- -
- - -
-
-
- image->getImg([]) ?> -
-
- - -
-
- - -
- - -
- -
-
-
\ No newline at end of file -- libgit2 0.21.4