Commit 3118df3a72e5db4d6056ae43dc3d2d7e3b8e3248
1 parent
3c14407f
-Blog ready without search
Showing
6 changed files
with
773 additions
and
34 deletions
Show diff stats
frontend/controllers/BlogController.php
... | ... | @@ -3,8 +3,11 @@ |
3 | 3 | namespace frontend\controllers; |
4 | 4 | |
5 | 5 | use artbox\weblog\models\Article; |
6 | + use artbox\weblog\models\Category; | |
7 | + use artbox\weblog\models\Tag; | |
6 | 8 | use yii\data\ActiveDataProvider; |
7 | 9 | use yii\web\Controller; |
10 | + use yii\web\NotFoundHttpException; | |
8 | 11 | |
9 | 12 | /** |
10 | 13 | * Class BlogController |
... | ... | @@ -15,6 +18,13 @@ |
15 | 18 | { |
16 | 19 | public function actionIndex() |
17 | 20 | { |
21 | + $tags = Tag::find() | |
22 | + ->with( | |
23 | + [ | |
24 | + 'lang', | |
25 | + ] | |
26 | + ) | |
27 | + ->all(); | |
18 | 28 | $dataProvider = new ActiveDataProvider( |
19 | 29 | [ |
20 | 30 | 'query' => Article::find() |
... | ... | @@ -22,6 +32,12 @@ |
22 | 32 | [ |
23 | 33 | 'created_at' => SORT_DESC, |
24 | 34 | ] |
35 | + ) | |
36 | + ->with( | |
37 | + [ | |
38 | + 'lang', | |
39 | + 'categories.lang', | |
40 | + ] | |
25 | 41 | ), |
26 | 42 | 'pagination' => [ |
27 | 43 | 'pageSize' => 3, |
... | ... | @@ -32,8 +48,167 @@ |
32 | 48 | return $this->render( |
33 | 49 | 'index', |
34 | 50 | [ |
51 | + 'tags' => $tags, | |
52 | + 'dataProvider' => $dataProvider, | |
53 | + ] | |
54 | + ); | |
55 | + } | |
56 | + | |
57 | + public function actionArticle($id) | |
58 | + { | |
59 | + $model = $this->findModel($id); | |
60 | + | |
61 | + $tags = Tag::find() | |
62 | + ->with([ 'lang' ]) | |
63 | + ->all(); | |
64 | + | |
65 | + return $this->render( | |
66 | + 'view', | |
67 | + [ | |
68 | + 'tags' => $tags, | |
69 | + 'model' => $model, | |
70 | + ] | |
71 | + ); | |
72 | + } | |
73 | + | |
74 | + public function actionCategory($id) | |
75 | + { | |
76 | + $tags = Tag::find() | |
77 | + ->with( | |
78 | + [ | |
79 | + 'lang', | |
80 | + ] | |
81 | + ) | |
82 | + ->all(); | |
83 | + | |
84 | + /** | |
85 | + * @var Category $model | |
86 | + */ | |
87 | + $model = Category::find() | |
88 | + ->where( | |
89 | + [ | |
90 | + 'id' => $id, | |
91 | + ] | |
92 | + ) | |
93 | + ->with( | |
94 | + [ | |
95 | + 'articles', | |
96 | + ] | |
97 | + ) | |
98 | + ->one(); | |
99 | + | |
100 | + $dataProvider = new ActiveDataProvider( | |
101 | + [ | |
102 | + 'query' => $model->getArticles() | |
103 | + ->with( | |
104 | + [ | |
105 | + 'lang', | |
106 | + 'categories.lang', | |
107 | + ] | |
108 | + ) | |
109 | + ->orderBy( | |
110 | + [ | |
111 | + 'created_at' => SORT_DESC, | |
112 | + ] | |
113 | + ), | |
114 | + 'pagination' => [ | |
115 | + 'pageSize' => 3, | |
116 | + ], | |
117 | + ] | |
118 | + ); | |
119 | + | |
120 | + return $this->render( | |
121 | + 'category', | |
122 | + [ | |
123 | + 'tags' => $tags, | |
35 | 124 | 'dataProvider' => $dataProvider, |
125 | + 'model' => $model, | |
36 | 126 | ] |
37 | 127 | ); |
38 | 128 | } |
129 | + | |
130 | + public function actionTag($id) | |
131 | + { | |
132 | + $tags = Tag::find() | |
133 | + ->with( | |
134 | + [ | |
135 | + 'lang', | |
136 | + ] | |
137 | + ) | |
138 | + ->all(); | |
139 | + | |
140 | + /** | |
141 | + * @var Category $model | |
142 | + */ | |
143 | + $model = Tag::find() | |
144 | + ->where( | |
145 | + [ | |
146 | + 'id' => $id, | |
147 | + ] | |
148 | + ) | |
149 | + ->with( | |
150 | + [ | |
151 | + 'articles', | |
152 | + ] | |
153 | + ) | |
154 | + ->one(); | |
155 | + | |
156 | + $dataProvider = new ActiveDataProvider( | |
157 | + [ | |
158 | + 'query' => $model->getArticles() | |
159 | + ->with( | |
160 | + [ | |
161 | + 'lang', | |
162 | + 'categories.lang', | |
163 | + ] | |
164 | + ) | |
165 | + ->orderBy( | |
166 | + [ | |
167 | + 'created_at' => SORT_DESC, | |
168 | + ] | |
169 | + ), | |
170 | + 'pagination' => [ | |
171 | + 'pageSize' => 3, | |
172 | + ], | |
173 | + ] | |
174 | + ); | |
175 | + | |
176 | + return $this->render( | |
177 | + 'tag', | |
178 | + [ | |
179 | + 'tags' => $tags, | |
180 | + 'dataProvider' => $dataProvider, | |
181 | + 'model' => $model, | |
182 | + ] | |
183 | + ); | |
184 | + } | |
185 | + | |
186 | + /** | |
187 | + * @param $id | |
188 | + * | |
189 | + * @return Article | |
190 | + * @throws \yii\web\NotFoundHttpException | |
191 | + */ | |
192 | + protected function findModel($id) | |
193 | + { | |
194 | + /** | |
195 | + * @var Article | null $model | |
196 | + */ | |
197 | + $model = Article::find() | |
198 | + ->where([ 'id' => $id ]) | |
199 | + ->with( | |
200 | + [ | |
201 | + 'lang', | |
202 | + 'categories.lang', | |
203 | + 'tags.lang', | |
204 | + ] | |
205 | + ) | |
206 | + ->one(); | |
207 | + | |
208 | + if (empty($model)) { | |
209 | + throw new NotFoundHttpException(\Yii::t('app', 'Article not found')); | |
210 | + } else { | |
211 | + return $model; | |
212 | + } | |
213 | + } | |
39 | 214 | } |
40 | 215 | \ No newline at end of file | ... | ... |
frontend/views/blog/_article.php
1 | 1 | <?php |
2 | 2 | |
3 | + use artbox\core\helpers\ImageHelper; | |
3 | 4 | use artbox\weblog\models\Article; |
5 | + use yii\bootstrap\Html; | |
6 | + use yii\helpers\Url; | |
4 | 7 | |
5 | 8 | /** |
6 | 9 | * @var Article $model |
... | ... | @@ -11,25 +14,73 @@ |
11 | 14 | <section class="post"> |
12 | 15 | <div class="row"> |
13 | 16 | <div class="col-md-4"> |
14 | - <div class="video"> | |
15 | - <div class="embed-responsive embed-responsive-4by3"> | |
16 | - <iframe class="embed-responsive-item" src="//www.youtube.com/embed/upZJpGrppJA"></iframe> | |
17 | - </div> | |
17 | + <div class="image"> | |
18 | + <a href="<?= Url::to( | |
19 | + [ | |
20 | + 'blog/article', | |
21 | + 'id' => $model->id, | |
22 | + ] | |
23 | + ) ?>"> | |
24 | + <?= ImageHelper::set($model->image ? $model->image->getPath() : '@frontend/web/img/no-image.png') | |
25 | + ->cropResize(263, 197) | |
26 | + ->renderImage( | |
27 | + [ | |
28 | + 'class' => 'img-responsive', | |
29 | + 'alt' => $model->lang->title, | |
30 | + ] | |
31 | + ) ?> | |
32 | + </a> | |
18 | 33 | </div> |
19 | 34 | </div> |
20 | 35 | <div class="col-md-8"> |
21 | - <h2><a href="blog-post.html">Название статьи</a></h2> | |
36 | + <h2><a href="<?= Url::to( | |
37 | + [ | |
38 | + 'blog/article', | |
39 | + 'id' => $model->id, | |
40 | + ] | |
41 | + ) ?>"><?= $model->lang->title; ?></a></h2> | |
22 | 42 | <div class="clearfix"> |
23 | - <p class="author-category">Автор: <a href="#">John Snow</a> в <a href="blog.html">Webdesign</a> | |
24 | - </p> | |
43 | + <?php if (empty($model->categories)) { ?> | |
44 | + <p class="author-category">Без категории </p> | |
45 | + <?php } else { | |
46 | + $i = 0; | |
47 | + foreach ($model->categories as $category) { | |
48 | + $i++; | |
49 | + ?> | |
50 | + <p class="author-category"><?php | |
51 | + echo Html::a( | |
52 | + $category->lang->title, | |
53 | + [ | |
54 | + 'blog/category', | |
55 | + 'id' => $category->id, | |
56 | + ] | |
57 | + ); | |
58 | + if ($i === count($model->categories)) { | |
59 | + echo ' '; | |
60 | + } else { | |
61 | + echo ', '; | |
62 | + } | |
63 | + ?></p> | |
64 | + <?php | |
65 | + } | |
66 | + } ?> | |
25 | 67 | <p class="date-comments"> |
26 | - <a href="blog-post.html"><i class="fa fa-calendar-o"></i> 20 июня 2013</a> | |
27 | - <a href="blog-post.html"><i class="fa fa-comment-o"></i> 8 комментариев</a> | |
68 | + <i class="fa fa-calendar-o"></i> <?= \Yii::$app->formatter->asDate($model->created_at); ?> | |
69 | + <!-- <a href="blog-post.html"><i class="fa fa-comment-o"></i> 8 комментариев</a>--> | |
28 | 70 | </p> |
29 | 71 | </div> |
30 | - <p class="intro">Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. | |
31 | - Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p> | |
32 | - <p class="read-more"><a href="blog-post.html" class="btn btn-template-main">Продолжить чтение</a> | |
72 | + <p class="intro"><?= $model->lang->body_preview; ?></p> | |
73 | + <p class="read-more"> | |
74 | + <?= Html::a( | |
75 | + 'Продолжить чтение', | |
76 | + [ | |
77 | + 'blog/article', | |
78 | + 'id' => $model->id, | |
79 | + ], | |
80 | + [ | |
81 | + 'class' => 'btn btn-template-main', | |
82 | + ] | |
83 | + ) ?> | |
33 | 84 | </p> |
34 | 85 | </div> |
35 | 86 | </div> | ... | ... |
1 | +<?php | |
2 | + | |
3 | + use artbox\core\components\SeoComponent; | |
4 | + use artbox\weblog\models\Category; | |
5 | + use artbox\weblog\models\Tag; | |
6 | + use yii\data\ActiveDataProvider; | |
7 | + use yii\helpers\Url; | |
8 | + use yii\web\View; | |
9 | + use yii\widgets\ListView; | |
10 | + | |
11 | + /** | |
12 | + * @var View $this | |
13 | + * @var ActiveDataProvider $dataProvider | |
14 | + * @var SeoComponent $seo | |
15 | + * @var Tag[] $tags | |
16 | + * @var Category $model | |
17 | + */ | |
18 | + $seo = \Yii::$app->get('seo'); | |
19 | + | |
20 | + $this->params[ 'breadcrumbs' ][] = [ | |
21 | + 'label' => \Yii::t('app', 'Блог'), | |
22 | + 'url' => [ 'blog/index' ], | |
23 | + ]; | |
24 | + | |
25 | + $this->params[ 'breadcrumbs' ][] = $seo->title; | |
26 | + | |
27 | +?> | |
28 | + | |
29 | +<div id="content"> | |
30 | + <div class="container"> | |
31 | + <div class="row"> | |
32 | + <!-- *** LEFT COLUMN *** | |
33 | +_________________________________________________________ --> | |
34 | + | |
35 | + | |
36 | + <!-- <ul class="pager">--> | |
37 | + <!-- <li class="previous"><a href="#">← Назад</a>--> | |
38 | + <!-- </li>--> | |
39 | + <!-- <li class="next disabled"><a href="#">Вперед →</a>--> | |
40 | + <!-- </li>--> | |
41 | + <!-- </ul>--> | |
42 | + | |
43 | + <!-- /.col-md-9 --> | |
44 | + | |
45 | + | |
46 | + <?= ListView::widget( | |
47 | + [ | |
48 | + 'dataProvider' => $dataProvider, | |
49 | + 'itemView' => '_article', | |
50 | + 'options' => [ | |
51 | + 'class' => 'col-md-9', | |
52 | + 'id' => 'blog-listing-medium', | |
53 | + ], | |
54 | + 'layout' => '{items}{pager}', | |
55 | + ] | |
56 | + ); ?> | |
57 | + | |
58 | + | |
59 | + <!-- *** LEFT COLUMN END *** --> | |
60 | + | |
61 | + <!-- *** RIGHT COLUMN *** | |
62 | +_________________________________________________________ --> | |
63 | + | |
64 | + <div class="col-md-3"> | |
65 | + | |
66 | + <!-- *** MENUS AND WIDGETS *** | |
67 | +_________________________________________________________ --> | |
68 | + <div class="panel panel-default sidebar-menu"> | |
69 | + | |
70 | + <div class="panel-heading"> | |
71 | + <h3 class="panel-title">Блог компании</h3> | |
72 | + </div> | |
73 | + | |
74 | + <div class="panel-body text-widget"> | |
75 | + <p> | |
76 | + Мы собираем полезные материалы по тематике бытовой техники и электроники | |
77 | + </p> | |
78 | + | |
79 | + </div> | |
80 | + </div> | |
81 | + | |
82 | + <div class="panel panel-default sidebar-menu"> | |
83 | + | |
84 | + <div class="panel-heading"> | |
85 | + <h3 class="panel-title">Поиск</h3> | |
86 | + </div> | |
87 | + | |
88 | + <div class="panel-body"> | |
89 | + <form role="search"> | |
90 | + <div class="input-group"> | |
91 | + <input type="text" class="form-control" placeholder="Поиск по статьям"> | |
92 | + <span class="input-group-btn"> | |
93 | + | |
94 | + <button type="submit" class="btn btn-template-main"><i class="fa fa-search"></i></button> | |
95 | + | |
96 | + </span> | |
97 | + </div> | |
98 | + </form> | |
99 | + </div> | |
100 | + </div> | |
101 | + | |
102 | + <div class="panel sidebar-menu"> | |
103 | + <div class="panel-heading"> | |
104 | + <h3 class="panel-title">Поиск по тегам</h3> | |
105 | + </div> | |
106 | + | |
107 | + <div class="panel-body"> | |
108 | + <ul class="tag-cloud"> | |
109 | + <?php foreach ($tags as $tag) { ?> | |
110 | + <li><a href="<?= Url::to( | |
111 | + [ | |
112 | + 'blog/tag', | |
113 | + 'id' => $tag->id, | |
114 | + ] | |
115 | + ) ?>"><i class="fa fa-tags"></i> <?= $tag->lang->label; ?></a> | |
116 | + </li> | |
117 | + <?php } ?> | |
118 | + </ul> | |
119 | + </div> | |
120 | + </div> | |
121 | + | |
122 | + <!-- *** MENUS AND FILTERS END *** --> | |
123 | + | |
124 | + </div> | |
125 | + <!-- /.col-md-3 --> | |
126 | + | |
127 | + <!-- *** RIGHT COLUMN END *** --> | |
128 | + | |
129 | + </div> | |
130 | + <!-- /.row --> | |
131 | + </div> | |
132 | + <!-- /.container --> | |
133 | +</div> | |
134 | +<!-- /#content --> | |
0 | 135 | \ No newline at end of file | ... | ... |
frontend/views/blog/index.php
1 | 1 | <?php |
2 | 2 | |
3 | + use artbox\core\components\SeoComponent; | |
4 | + use artbox\weblog\models\Tag; | |
3 | 5 | use yii\data\ActiveDataProvider; |
6 | + use yii\helpers\Url; | |
4 | 7 | use yii\web\View; |
5 | 8 | use yii\widgets\ListView; |
6 | 9 | |
7 | 10 | /** |
8 | 11 | * @var View $this |
9 | 12 | * @var ActiveDataProvider $dataProvider |
13 | + * @var SeoComponent $seo | |
14 | + * @var Tag[] $tags | |
10 | 15 | */ |
16 | + $seo = \Yii::$app->get('seo'); | |
17 | + | |
18 | + $this->params[ 'breadcrumbs' ][] = $seo->title; | |
11 | 19 | |
12 | 20 | ?> |
13 | 21 | |
... | ... | @@ -16,19 +24,15 @@ |
16 | 24 | <div class="row"> |
17 | 25 | <!-- *** LEFT COLUMN *** |
18 | 26 | _________________________________________________________ --> |
27 | + | |
28 | + | |
29 | + <!-- <ul class="pager">--> | |
30 | + <!-- <li class="previous"><a href="#">← Назад</a>--> | |
31 | + <!-- </li>--> | |
32 | + <!-- <li class="next disabled"><a href="#">Вперед →</a>--> | |
33 | + <!-- </li>--> | |
34 | + <!-- </ul>--> | |
19 | 35 | |
20 | - <div class="col-md-9" id="blog-listing-medium"> | |
21 | - | |
22 | - | |
23 | - <ul class="pager"> | |
24 | - <li class="previous"><a href="#">← Назад</a> | |
25 | - </li> | |
26 | - <li class="next disabled"><a href="#">Вперед →</a> | |
27 | - </li> | |
28 | - </ul> | |
29 | - | |
30 | - | |
31 | - </div> | |
32 | 36 | <!-- /.col-md-9 --> |
33 | 37 | |
34 | 38 | |
... | ... | @@ -40,6 +44,7 @@ _________________________________________________________ --> |
40 | 44 | 'class' => 'col-md-9', |
41 | 45 | 'id' => 'blog-listing-medium', |
42 | 46 | ], |
47 | + 'layout' => '{items}{pager}', | |
43 | 48 | ] |
44 | 49 | ); ?> |
45 | 50 | |
... | ... | @@ -94,16 +99,15 @@ _________________________________________________________ --> |
94 | 99 | |
95 | 100 | <div class="panel-body"> |
96 | 101 | <ul class="tag-cloud"> |
97 | - <li><a href="#"><i class="fa fa-tags"></i> Обзор</a> | |
98 | - </li> | |
99 | - <li><a href="#"><i class="fa fa-tags"></i> Ноутбук</a> | |
100 | - </li> | |
101 | - <li><a href="#"><i class="fa fa-tags"></i> ПК</a> | |
102 | - </li> | |
103 | - <li><a href="#"><i class="fa fa-tags"></i> Моноблок</a> | |
104 | - </li> | |
105 | - <li><a href="#"><i class="fa fa-tags"></i> Смартфоны</a> | |
106 | - </li> | |
102 | + <?php foreach ($tags as $tag) { ?> | |
103 | + <li><a href="<?= Url::to( | |
104 | + [ | |
105 | + 'blog/tag', | |
106 | + 'id' => $tag->id, | |
107 | + ] | |
108 | + ) ?>"><i class="fa fa-tags"></i> <?= $tag->lang->label; ?></a> | |
109 | + </li> | |
110 | + <?php } ?> | |
107 | 111 | </ul> |
108 | 112 | </div> |
109 | 113 | </div> | ... | ... |
1 | +<?php | |
2 | + | |
3 | + use artbox\core\components\SeoComponent; | |
4 | + use artbox\weblog\models\Tag; | |
5 | + use yii\data\ActiveDataProvider; | |
6 | + use yii\helpers\Url; | |
7 | + use yii\web\View; | |
8 | + use yii\widgets\ListView; | |
9 | + | |
10 | + /** | |
11 | + * @var View $this | |
12 | + * @var ActiveDataProvider $dataProvider | |
13 | + * @var SeoComponent $seo | |
14 | + * @var Tag[] $tags | |
15 | + * @var Tag $model | |
16 | + */ | |
17 | + $seo = \Yii::$app->get('seo'); | |
18 | + | |
19 | + $this->params[ 'breadcrumbs' ][] = [ | |
20 | + 'label' => \Yii::t('app', 'Блог'), | |
21 | + 'url' => [ 'blog/index' ], | |
22 | + ]; | |
23 | + | |
24 | + $this->params[ 'breadcrumbs' ][] = $seo->title; | |
25 | + | |
26 | +?> | |
27 | + | |
28 | +<div id="content"> | |
29 | + <div class="container"> | |
30 | + <div class="row"> | |
31 | + <!-- *** LEFT COLUMN *** | |
32 | +_________________________________________________________ --> | |
33 | + | |
34 | + | |
35 | + <!-- <ul class="pager">--> | |
36 | + <!-- <li class="previous"><a href="#">← Назад</a>--> | |
37 | + <!-- </li>--> | |
38 | + <!-- <li class="next disabled"><a href="#">Вперед →</a>--> | |
39 | + <!-- </li>--> | |
40 | + <!-- </ul>--> | |
41 | + | |
42 | + <!-- /.col-md-9 --> | |
43 | + | |
44 | + | |
45 | + <?= ListView::widget( | |
46 | + [ | |
47 | + 'dataProvider' => $dataProvider, | |
48 | + 'itemView' => '_article', | |
49 | + 'options' => [ | |
50 | + 'class' => 'col-md-9', | |
51 | + 'id' => 'blog-listing-medium', | |
52 | + ], | |
53 | + 'layout' => '{items}{pager}', | |
54 | + ] | |
55 | + ); ?> | |
56 | + | |
57 | + | |
58 | + <!-- *** LEFT COLUMN END *** --> | |
59 | + | |
60 | + <!-- *** RIGHT COLUMN *** | |
61 | +_________________________________________________________ --> | |
62 | + | |
63 | + <div class="col-md-3"> | |
64 | + | |
65 | + <!-- *** MENUS AND WIDGETS *** | |
66 | +_________________________________________________________ --> | |
67 | + <div class="panel panel-default sidebar-menu"> | |
68 | + | |
69 | + <div class="panel-heading"> | |
70 | + <h3 class="panel-title">Блог компании</h3> | |
71 | + </div> | |
72 | + | |
73 | + <div class="panel-body text-widget"> | |
74 | + <p> | |
75 | + Мы собираем полезные материалы по тематике бытовой техники и электроники | |
76 | + </p> | |
77 | + | |
78 | + </div> | |
79 | + </div> | |
80 | + | |
81 | + <div class="panel panel-default sidebar-menu"> | |
82 | + | |
83 | + <div class="panel-heading"> | |
84 | + <h3 class="panel-title">Поиск</h3> | |
85 | + </div> | |
86 | + | |
87 | + <div class="panel-body"> | |
88 | + <form role="search"> | |
89 | + <div class="input-group"> | |
90 | + <input type="text" class="form-control" placeholder="Поиск по статьям"> | |
91 | + <span class="input-group-btn"> | |
92 | + | |
93 | + <button type="submit" class="btn btn-template-main"><i class="fa fa-search"></i></button> | |
94 | + | |
95 | + </span> | |
96 | + </div> | |
97 | + </form> | |
98 | + </div> | |
99 | + </div> | |
100 | + | |
101 | + <div class="panel sidebar-menu"> | |
102 | + <div class="panel-heading"> | |
103 | + <h3 class="panel-title">Поиск по тегам</h3> | |
104 | + </div> | |
105 | + | |
106 | + <div class="panel-body"> | |
107 | + <ul class="tag-cloud"> | |
108 | + <?php foreach ($tags as $tag) { ?> | |
109 | + <li><a href="<?= Url::to( | |
110 | + [ | |
111 | + 'blog/tag', | |
112 | + 'id' => $tag->id, | |
113 | + ] | |
114 | + ) ?>"><i class="fa fa-tags"></i> <?= $tag->lang->label; ?></a> | |
115 | + </li> | |
116 | + <?php } ?> | |
117 | + </ul> | |
118 | + </div> | |
119 | + </div> | |
120 | + | |
121 | + <!-- *** MENUS AND FILTERS END *** --> | |
122 | + | |
123 | + </div> | |
124 | + <!-- /.col-md-3 --> | |
125 | + | |
126 | + <!-- *** RIGHT COLUMN END *** --> | |
127 | + | |
128 | + </div> | |
129 | + <!-- /.row --> | |
130 | + </div> | |
131 | + <!-- /.container --> | |
132 | +</div> | |
133 | +<!-- /#content --> | |
0 | 134 | \ No newline at end of file | ... | ... |
1 | +<?php | |
2 | + | |
3 | + use artbox\weblog\models\Article; | |
4 | + use artbox\weblog\models\Tag; | |
5 | + use yii\helpers\Url; | |
6 | + use yii\web\View; | |
7 | + | |
8 | + /** | |
9 | + * @var View $this | |
10 | + * @var Article $model | |
11 | + * @var Tag[] $tags | |
12 | + */ | |
13 | + | |
14 | + $this->params[ 'breadcrumbs' ][] = [ | |
15 | + 'label' => \Yii::t('app', 'Блог'), | |
16 | + 'url' => [ 'blog/index' ], | |
17 | + ]; | |
18 | + | |
19 | + $this->params[ 'breadcrumbs' ][] = $model->lang->title; | |
20 | + | |
21 | +?> | |
22 | + | |
23 | +<div id="content"> | |
24 | + <div class="container"> | |
25 | + | |
26 | + <div class="row"> | |
27 | + | |
28 | + <!-- *** LEFT COLUMN *** | |
29 | +_________________________________________________________ --> | |
30 | + | |
31 | + <div class="col-md-9" id="blog-post"> | |
32 | + | |
33 | + <h2><?= $model->lang->title; ?></h2> | |
34 | + | |
35 | + <?php if (!empty($model->tags)) { ?> | |
36 | + <div class="panel sidebar-menu"> | |
37 | + <div class="panel-body"> | |
38 | + <ul class="tag-cloud"> | |
39 | + <?php foreach ($model->tags as $tag) { ?> | |
40 | + <li><a href="<?= Url::to( | |
41 | + [ | |
42 | + 'blog/tag', | |
43 | + 'id' => $tag->id, | |
44 | + ] | |
45 | + ) ?>"><i class="fa fa-tags"></i> <?= $tag->lang->label; ?></a> | |
46 | + </li> | |
47 | + <?php } ?> | |
48 | + </ul> | |
49 | + </div> | |
50 | + </div> | |
51 | + <?php } ?> | |
52 | + | |
53 | + <p class="text-muted text-uppercase mb-small text-left"><?= \Yii::$app->formatter->asDate( | |
54 | + $model->created_at | |
55 | + ); ?></p> | |
56 | + | |
57 | + <div id="post-content"> | |
58 | + | |
59 | + <?= $model->lang->body; ?> | |
60 | + | |
61 | + </div> | |
62 | + <!-- /#post-content --> | |
63 | + | |
64 | + <?php | |
65 | + /* | |
66 | + | |
67 | + <div id="comments"> | |
68 | + <h4 class="text-uppercase">2 comments</h4> | |
69 | + | |
70 | + | |
71 | + <div class="row comment"> | |
72 | + <div class="col-sm-3 col-md-2 text-center-xs"> | |
73 | + <p> | |
74 | + <img src="img/blog-avatar2.jpg" class="img-responsive img-circle" alt=""> | |
75 | + </p> | |
76 | + </div> | |
77 | + <div class="col-sm-9 col-md-10"> | |
78 | + <h5 class="text-uppercase">Julie Alma</h5> | |
79 | + <p class="posted"><i class="fa fa-clock-o"></i> September 23, 2011 в 12:00</p> | |
80 | + <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. | |
81 | + Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p> | |
82 | + <p class="reply"><a href="#"><i class="fa fa-reply"></i> Ответить</a> | |
83 | + </p> | |
84 | + </div> | |
85 | + </div> | |
86 | + <!-- /.comment --> | |
87 | + | |
88 | + | |
89 | + <div class="row comment last"> | |
90 | + | |
91 | + <div class="col-sm-3 col-md-2 text-center-xs"> | |
92 | + <p> | |
93 | + <img src="img/blog-avatar.jpg" class="img-responsive img-circle" alt=""> | |
94 | + </p> | |
95 | + </div> | |
96 | + | |
97 | + <div class="col-sm-9 col-md-10"> | |
98 | + <h5 class="text-uppercase">Louise Armero</h5> | |
99 | + <p class="posted"><i class="fa fa-clock-o"></i> 23 сентября 2012 в 12:00</p> | |
100 | + <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. | |
101 | + Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p> | |
102 | + <p class="reply"><a href="#"><i class="fa fa-reply"></i> Ответить</a> | |
103 | + </p> | |
104 | + </div> | |
105 | + | |
106 | + </div> | |
107 | + <!-- /.comment --> | |
108 | + </div> | |
109 | + <!-- /#comments --> | |
110 | + | |
111 | + | |
112 | + <div id="comment-form"> | |
113 | + | |
114 | + <h4 class="text-uppercase">Leave comment</h4> | |
115 | + | |
116 | + <form> | |
117 | + <div class="row"> | |
118 | + | |
119 | + <div class="col-sm-6"> | |
120 | + <div class="form-group"> | |
121 | + <label for="name">Name <span class="required">*</span> | |
122 | + </label> | |
123 | + <input type="text" class="form-control" id="name"> | |
124 | + </div> | |
125 | + </div> | |
126 | + | |
127 | + </div> | |
128 | + | |
129 | + <div class="row"> | |
130 | + <div class="col-sm-6"> | |
131 | + <div class="form-group"> | |
132 | + <label for="email">Email <span class="required">*</span> | |
133 | + </label> | |
134 | + <input type="text" class="form-control" id="email"> | |
135 | + </div> | |
136 | + </div> | |
137 | + </div> | |
138 | + | |
139 | + <div class="row"> | |
140 | + <div class="col-sm-12"> | |
141 | + <div class="form-group"> | |
142 | + <label for="comment">Comment <span class="required">*</span> | |
143 | + </label> | |
144 | + <textarea class="form-control" id="comment" rows="4"></textarea> | |
145 | + </div> | |
146 | + </div> | |
147 | + </div> | |
148 | + | |
149 | + <div class="row"> | |
150 | + <div class="col-sm-12 text-right"> | |
151 | + <button class="btn btn-template-main"><i class="fa fa-comment-o"></i> Post comment</button> | |
152 | + </div> | |
153 | + </div> | |
154 | + | |
155 | + | |
156 | + </form> | |
157 | + | |
158 | + </div> | |
159 | + <!-- /#comment-form --> | |
160 | + */ | |
161 | + ?> | |
162 | + </div> | |
163 | + <!-- /#blog-post --> | |
164 | + | |
165 | + <!-- *** LEFT COLUMN END *** --> | |
166 | + | |
167 | + <!-- *** RIGHT COLUMN *** | |
168 | + _________________________________________________________ --> | |
169 | + | |
170 | + <div class="col-md-3"> | |
171 | + | |
172 | + <!-- *** MENUS AND WIDGETS *** | |
173 | +_________________________________________________________ --> | |
174 | + <div class="panel panel-default sidebar-menu"> | |
175 | + | |
176 | + <div class="panel-heading"> | |
177 | + <h3 class="panel-title">Блог компании</h3> | |
178 | + </div> | |
179 | + | |
180 | + <div class="panel-body text-widget"> | |
181 | + <p> | |
182 | + Мы собираем полезные материалы по тематике бытовой техники и электроники | |
183 | + </p> | |
184 | + | |
185 | + </div> | |
186 | + </div> | |
187 | + | |
188 | + <div class="panel panel-default sidebar-menu"> | |
189 | + | |
190 | + <div class="panel-heading"> | |
191 | + <h3 class="panel-title">Поиск</h3> | |
192 | + </div> | |
193 | + | |
194 | + <div class="panel-body"> | |
195 | + <form role="search"> | |
196 | + <div class="input-group"> | |
197 | + <input type="text" class="form-control" placeholder="Поиск по статьям"> | |
198 | + <span class="input-group-btn"> | |
199 | + | |
200 | + <button type="submit" class="btn btn-template-main"><i class="fa fa-search"></i></button> | |
201 | + | |
202 | + </span> | |
203 | + </div> | |
204 | + </form> | |
205 | + </div> | |
206 | + </div> | |
207 | + | |
208 | + <div class="panel sidebar-menu"> | |
209 | + <div class="panel-heading"> | |
210 | + <h3 class="panel-title">Поиск по тегам</h3> | |
211 | + </div> | |
212 | + | |
213 | + <div class="panel-body"> | |
214 | + <ul class="tag-cloud"> | |
215 | + <?php foreach ($tags as $tag) { ?> | |
216 | + <li><a href="<?= Url::to( | |
217 | + [ | |
218 | + 'blog/tag', | |
219 | + 'id' => $tag->id, | |
220 | + ] | |
221 | + ) ?>"><i class="fa fa-tags"></i> <?= $tag->lang->label; ?></a> | |
222 | + </li> | |
223 | + <?php } ?> | |
224 | + </ul> | |
225 | + </div> | |
226 | + </div> | |
227 | + | |
228 | + <!-- *** MENUS AND FILTERS END *** --> | |
229 | + | |
230 | + </div> | |
231 | + <!-- /.col-md-3 --> | |
232 | + <!-- *** RIGHT COLUMN END *** --> | |
233 | + | |
234 | + | |
235 | + </div> | |
236 | + <!-- /.row --> | |
237 | + | |
238 | + </div> | |
239 | + <!-- /.container --> | |
240 | +</div> | |
241 | +<!-- /#content --> | |
242 | + | |
0 | 243 | \ No newline at end of file | ... | ... |