Commit 8c8f7aebdebeb08c8002bcb670d005fc1c2c1379
1 parent
5bf1f8a0
- blog view
Showing
13 changed files
with
307 additions
and
206 deletions
Show diff stats
common/models/Book.php
... | ... | @@ -165,7 +165,7 @@ |
165 | 165 | } |
166 | 166 | |
167 | 167 | public function getActiveComments(){ |
168 | - return $this->hasMany(Comment::className(), ['book_id' => 'id'])->with('activeComments')->where(['status' => true, 'parent_id' => null])->orderBy('created_at'); | |
168 | + return $this->hasMany(Comment::className(), ['entity_id' => 'id'])->andWhere(['entity' => Book::className()])->with('activeComments')->where(['status' => true, 'parent_id' => null])->orderBy('created_at'); | |
169 | 169 | } |
170 | 170 | |
171 | 171 | } | ... | ... |
common/models/Comment.php
... | ... | @@ -46,7 +46,7 @@ |
46 | 46 | return [ |
47 | 47 | [ |
48 | 48 | [ |
49 | - 'book_id', | |
49 | + 'entity_id', | |
50 | 50 | 'parent_id', |
51 | 51 | ], |
52 | 52 | 'default', |
... | ... | @@ -54,13 +54,13 @@ |
54 | 54 | ], |
55 | 55 | [ |
56 | 56 | [ |
57 | - 'book_id', | |
57 | + 'entity_id', | |
58 | 58 | 'parent_id', |
59 | 59 | ], |
60 | 60 | 'integer', |
61 | 61 | ], |
62 | 62 | [ |
63 | - [ 'comment' ], | |
63 | + [ 'comment', 'entity' ], | |
64 | 64 | 'string', |
65 | 65 | ], |
66 | 66 | [ |
... | ... | @@ -76,13 +76,6 @@ |
76 | 76 | 'max' => 255, |
77 | 77 | ], |
78 | 78 | [ |
79 | - [ 'book_id' ], | |
80 | - 'exist', | |
81 | - 'skipOnError' => true, | |
82 | - 'targetClass' => Book::className(), | |
83 | - 'targetAttribute' => [ 'book_id' => 'id' ], | |
84 | - ], | |
85 | - [ | |
86 | 79 | [ 'parent_id' ], |
87 | 80 | 'exist', |
88 | 81 | 'skipOnError' => true, | ... | ... |
common/models/blog/Article.php
... | ... | @@ -4,6 +4,7 @@ |
4 | 4 | |
5 | 5 | use artbox\core\models\Image; |
6 | 6 | use artbox\core\models\traits\AliasableTrait; |
7 | + use common\models\Comment; | |
7 | 8 | use yii\behaviors\TimestampBehavior; |
8 | 9 | use yii\db\ActiveRecord; |
9 | 10 | use artbox\core\models\Language; |
... | ... | @@ -262,4 +263,8 @@ |
262 | 263 | return $this->hasMany(Tag::className(), [ 'id' => 'blog_tag_id' ]) |
263 | 264 | ->viaTable('blog_article_to_tag', [ 'blog_article_id' => 'id' ]); |
264 | 265 | } |
266 | + | |
267 | + public function getActiveComments(){ | |
268 | + return $this->hasMany(Comment::className(), ['entity_id' => 'id'])->andWhere(['entity' => Article::className()])->with('activeComments')->where(['status' => true, 'parent_id' => null])->orderBy('created_at'); | |
269 | + } | |
265 | 270 | } | ... | ... |
console/migrations/m180621_144704_alter_table_page.php
0 โ 100644
1 | +<?php | |
2 | + | |
3 | +use yii\db\Migration; | |
4 | + | |
5 | +/** | |
6 | + * Class m180621_144704_alter_table_page | |
7 | + */ | |
8 | +class m180621_144704_alter_table_page extends Migration | |
9 | +{ | |
10 | + /** | |
11 | + * {@inheritdoc} | |
12 | + */ | |
13 | + public function safeUp() | |
14 | + { | |
15 | + $this->dropColumn('page', 'created_at'); | |
16 | + $this->dropColumn('page', 'updated_at'); | |
17 | + $this->addColumn('page', 'created_at', $this->integer()); | |
18 | + $this->addColumn('page', 'updated_at', $this->integer()); | |
19 | + } | |
20 | + | |
21 | + /** | |
22 | + * {@inheritdoc} | |
23 | + */ | |
24 | + public function safeDown() | |
25 | + { | |
26 | + echo "m180621_144704_alter_table_page cannot be reverted.\n"; | |
27 | + | |
28 | + return false; | |
29 | + } | |
30 | + | |
31 | +} | ... | ... |
console/migrations/m180626_065650_alter_table_author.php
0 โ 100644
1 | +<?php | |
2 | + | |
3 | +use yii\db\Migration; | |
4 | + | |
5 | +/** | |
6 | + * Class m180626_065650_alter_table_author | |
7 | + */ | |
8 | +class m180626_065650_alter_table_author extends Migration | |
9 | +{ | |
10 | + /** | |
11 | + * {@inheritdoc} | |
12 | + */ | |
13 | + public function safeUp() | |
14 | + { | |
15 | + $this->addColumn('author', 'avatar', $this->string()); | |
16 | + } | |
17 | + | |
18 | + /** | |
19 | + * {@inheritdoc} | |
20 | + */ | |
21 | + public function safeDown() | |
22 | + { | |
23 | + $this->dropColumn('author', 'avatar'); | |
24 | + } | |
25 | + | |
26 | + /* | |
27 | + // Use up()/down() to run migration code without a transaction. | |
28 | + public function up() | |
29 | + { | |
30 | + | |
31 | + } | |
32 | + | |
33 | + public function down() | |
34 | + { | |
35 | + echo "m180626_065650_alter_table_author cannot be reverted.\n"; | |
36 | + | |
37 | + return false; | |
38 | + } | |
39 | + */ | |
40 | +} | ... | ... |
console/migrations/m180626_133815_alter_table_blog_article.php
0 โ 100644
1 | +<?php | |
2 | + | |
3 | +use yii\db\Migration; | |
4 | + | |
5 | +/** | |
6 | + * Class m180626_133815_alter_table_blog_article | |
7 | + */ | |
8 | +class m180626_133815_alter_table_blog_article extends Migration | |
9 | +{ | |
10 | + /** | |
11 | + * {@inheritdoc} | |
12 | + */ | |
13 | + public function safeUp() | |
14 | + { | |
15 | + $this->addColumn('blog_article', 'view', $this->integer()->defaultValue(0)); | |
16 | + } | |
17 | + | |
18 | + /** | |
19 | + * {@inheritdoc} | |
20 | + */ | |
21 | + public function safeDown() | |
22 | + { | |
23 | + $this->dropColumn('blog_article', 'view'); | |
24 | + } | |
25 | + | |
26 | + /* | |
27 | + // Use up()/down() to run migration code without a transaction. | |
28 | + public function up() | |
29 | + { | |
30 | + | |
31 | + } | |
32 | + | |
33 | + public function down() | |
34 | + { | |
35 | + echo "m180626_133815_alter_table_blog_article cannot be reverted.\n"; | |
36 | + | |
37 | + return false; | |
38 | + } | |
39 | + */ | |
40 | +} | ... | ... |
console/migrations/m180627_093149_alter_table_comments.php
0 โ 100644
1 | +<?php | |
2 | + | |
3 | +use yii\db\Migration; | |
4 | + | |
5 | +/** | |
6 | + * Class m180627_093149_alter_table_comments | |
7 | + */ | |
8 | +class m180627_093149_alter_table_comments extends Migration | |
9 | +{ | |
10 | + /** | |
11 | + * {@inheritdoc} | |
12 | + */ | |
13 | + public function safeUp() | |
14 | + { | |
15 | + $this->dropForeignKey('comment_book_fk', 'comment'); | |
16 | + $this->dropColumn('comment', 'book_id'); | |
17 | + $this->addColumn('comment', 'entity', $this->string()); | |
18 | + $this->addColumn('comment', 'entity_id', $this->integer()); | |
19 | + } | |
20 | + | |
21 | + /** | |
22 | + * {@inheritdoc} | |
23 | + */ | |
24 | + public function safeDown() | |
25 | + { | |
26 | + echo "m180627_093149_alter_table_comments cannot be reverted.\n"; | |
27 | + | |
28 | + return false; | |
29 | + } | |
30 | + | |
31 | + /* | |
32 | + // Use up()/down() to run migration code without a transaction. | |
33 | + public function up() | |
34 | + { | |
35 | + | |
36 | + } | |
37 | + | |
38 | + public function down() | |
39 | + { | |
40 | + echo "m180627_093149_alter_table_comments cannot be reverted.\n"; | |
41 | + | |
42 | + return false; | |
43 | + } | |
44 | + */ | |
45 | +} | ... | ... |
frontend/config/main.php
... | ... | @@ -146,7 +146,8 @@ |
146 | 146 | 'name', |
147 | 147 | 'email', |
148 | 148 | 'comment', |
149 | - 'book_id', | |
149 | + 'entity_id', | |
150 | + 'entity', | |
150 | 151 | 'parent_id' |
151 | 152 | ], |
152 | 153 | 'templateForm' => '<div class="style title-add-comments-form">ะะพะดะฐัะธ ะบะพะผะตะฝัะฐั</div>{form}', |
... | ... | @@ -163,7 +164,8 @@ |
163 | 164 | 'name' => 'ะะผ\'ั', |
164 | 165 | 'email' => 'ะะพััะฐ', |
165 | 166 | 'comment' => 'ะบะพะผะตะฝัะฐั', |
166 | - 'book_id' => false, | |
167 | + 'entity_id' => false, | |
168 | + 'entity' => false, | |
167 | 169 | 'parent_id' => false |
168 | 170 | ], |
169 | 171 | |
... | ... | @@ -202,7 +204,8 @@ |
202 | 204 | 'name', |
203 | 205 | 'email', |
204 | 206 | 'comment', |
205 | - 'book_id', | |
207 | + 'entity_id', | |
208 | + 'entity', | |
206 | 209 | 'parent_id' |
207 | 210 | ], |
208 | 211 | 'templateForm' => '<div class="style title-add-comments-form">ะัะดะฟะพะฒัััะธ</div>{form}', |
... | ... | @@ -219,7 +222,8 @@ |
219 | 222 | 'name' => 'ะะผ\'ั', |
220 | 223 | 'email' => 'ะะพััะฐ', |
221 | 224 | 'comment' => 'ะบะพะผะตะฝัะฐั', |
222 | - 'book_id' => false, | |
225 | + 'entity_id' => false, | |
226 | + 'entity' => false, | |
223 | 227 | 'parent_id' => false |
224 | 228 | ], |
225 | 229 | ... | ... |
frontend/controllers/BlogController.php
... | ... | @@ -62,7 +62,8 @@ |
62 | 62 | public function actionView($id) |
63 | 63 | { |
64 | 64 | $model = $this->findModel($id); |
65 | - | |
65 | + $model->view +=1; | |
66 | + $model->save(); | |
66 | 67 | $tags = Tag::find() |
67 | 68 | ->with([ 'language' ]) |
68 | 69 | ->orderBy([ 'sort' => SORT_ASC ]) |
... | ... | @@ -211,8 +212,10 @@ |
211 | 212 | ->with( |
212 | 213 | [ |
213 | 214 | 'language', |
214 | - 'categories.language', | |
215 | - 'tags.language', | |
215 | + 'tags.language.alias', | |
216 | + 'relatedBlogArticles.language.alias', | |
217 | + 'relatedBlogArticles.tags.language.alias', | |
218 | + 'activeComments' | |
216 | 219 | ] |
217 | 220 | ) |
218 | 221 | ->andWhere([ 'status' => true ]) | ... | ... |
frontend/views/blog/_article.php
... | ... | @@ -20,7 +20,7 @@ |
20 | 20 | <div class="style icons-blog-wr"> |
21 | 21 | <span><?=date('d.m.Y', $model->created_at)?></span> |
22 | 22 | <span><?=$model->view?> ะฟะตัะตะณะปัะดัะฒ</span> |
23 | - <span>48 ะบะพะผะตะฝัะฐััะฒ</span> | |
23 | + <span><?=count($model->activeComments)?> ะบะพะผะตะฝัะฐััะฒ</span> | |
24 | 24 | </div> |
25 | 25 | <?php if (!empty($model->tags)){?> |
26 | 26 | <div class="style items-blog-tags"> | ... | ... |
frontend/views/blog/view.php
1 | 1 | <?php |
2 | 2 | |
3 | + use artbox\core\helpers\ImageHelper; | |
3 | 4 | use common\models\blog\Article; |
4 | 5 | use common\models\blog\Tag; |
5 | 6 | use frontend\widgets\BlogSearch; |
... | ... | @@ -10,6 +11,8 @@ |
10 | 11 | * @var View $this |
11 | 12 | * @var Article $model |
12 | 13 | * @var Tag[] $tags |
14 | + * @var \artbox\core\forms\Module $module | |
15 | + * @var \artbox\core\forms\Module $moduleAnswer | |
13 | 16 | */ |
14 | 17 | |
15 | 18 | $this->params[ 'breadcrumbs' ][] = [ |
... | ... | @@ -17,207 +20,140 @@ |
17 | 20 | 'url' => [ 'blog/index' ], |
18 | 21 | ]; |
19 | 22 | |
20 | - $this->params[ 'breadcrumbs' ][] = $model->title; | |
23 | + $this->params[ 'breadcrumbs' ][] = $model->language->title; | |
24 | + | |
25 | + $module = \Yii::$app->getModule('comments'); | |
26 | + $module->inputOptions += ['entity_id' => [ | |
27 | + 'type' => 'hiddenInput', | |
28 | + 'options' => ['value' => $model->id], | |
29 | + ]]; | |
30 | + $module->inputOptions += ['entity' => [ | |
31 | + 'type' => 'hiddenInput', | |
32 | + 'options' => ['value' => \common\models\Book::class], | |
33 | + ]]; | |
34 | + $module->inputOptions += ['parent_id' => [ | |
35 | + 'type' => 'hiddenInput', | |
36 | + 'options' => ['value' => ''], | |
37 | + ]]; | |
38 | + | |
39 | + $moduleAnswer = \Yii::$app->getModule('commentsChild'); | |
40 | + $moduleAnswer->inputOptions += ['book_id' => [ | |
41 | + 'type' => 'hiddenInput', | |
42 | + 'options' => ['value' => $model->id], | |
43 | + ]]; | |
44 | + $moduleAnswer->inputOptions += ['parent_id' => [ | |
45 | + 'type' => 'hiddenInput', | |
46 | + 'options' => ['value' => ''], | |
47 | + ]]; | |
48 | +?> | |
21 | 49 | |
22 | 50 | ?> |
23 | 51 | |
24 | -<div id="content"> | |
52 | +<section class="blog-view-section"> | |
25 | 53 | <div class="container"> |
26 | - | |
27 | 54 | <div class="row"> |
28 | - | |
29 | - <!-- *** LEFT COLUMN *** | |
30 | -_________________________________________________________ --> | |
31 | - | |
32 | - <div class="col-md-9" id="blog-post"> | |
33 | - | |
34 | - <h2><?= $model->title; ?></h2> | |
35 | - | |
36 | - <?php if (!empty($model->tags)) { ?> | |
37 | - <div class="panel sidebar-menu"> | |
38 | - <div class="panel-body"> | |
39 | - <ul class="tag-cloud"> | |
40 | - <?php foreach ($model->tags as $tag) { ?> | |
41 | - <li><a href="<?= Url::to( | |
42 | - [ | |
43 | - 'alias' => $tag->alias | |
44 | - ] | |
45 | - ) ?>"><i class="fa fa-tags"></i> <?= $tag->label; ?></a> | |
46 | - </li> | |
47 | - <?php } ?> | |
48 | - </ul> | |
55 | + <div class="col-xs-12"> | |
56 | + <h1 class="title-blog-view"> | |
57 | + <?=$model->language->title?> | |
58 | + </h1> | |
59 | + </div> | |
60 | + <div class="col-xs-12"> | |
61 | + <div class="style icons-blog-wr"> | |
62 | + <span><?=date('d.m.Y', $model->created_at)?></span> | |
63 | + <span><?=$model->view?> ะฟะตัะตะณะปัะดัะฒ</span> | |
64 | + <span><?=count($model->activeComments)?> ะบะพะผะตะฝัะฐััะฒ</span> | |
65 | + </div> | |
66 | + </div> | |
67 | + <div class="col-xs-12 col-sm-12 blog-view"> | |
68 | + <!--556x320--> | |
69 | + <?=ImageHelper::set((!empty($model->image)) ? $model->image->getUrl() : null)->cropResize(556, 320)->renderImage(['style' => 'float:left'])?> | |
70 | + <?=$model->language->body?> | |
71 | + </div> | |
72 | + <div class="col-xs-12 col-sm-12"> | |
73 | + <?php if (!empty($model->tags)){?> | |
74 | + <div class="style items-blog-tags"> | |
75 | + <?php foreach ($model->tags as $tag){?> | |
76 | + <a href="<?=Url::to(['alias' => $tag->language->alias])?>"><?=$tag->language->label?></a> | |
77 | + <?php } ?> | |
78 | + </div> | |
79 | + <?php } ?> | |
80 | + </div> | |
81 | + </div> | |
82 | + <div class="row"> | |
83 | + <div class="col-xs-12 col-sm-12"> | |
84 | + <div class="card-desk-title">ะบะพะผะตะฝัะฐัั</div> | |
85 | + </div> | |
86 | + </div> | |
87 | + <div class="row"> | |
88 | + <div class="col-xs-12 col-sm-6 col-md-6 comments-card-col"> | |
89 | + <?php if (!empty($model->activeComments)){?> | |
90 | + <div class="hidden-comments-form-card style" style="display: none;"> | |
91 | + <div class="style card-form-add-wrapp"> | |
92 | + <?php $moduleAnswer->renderForm($this)?> | |
49 | 93 | </div> |
50 | 94 | </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->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> | |
95 | + <div class="style"> | |
96 | + <?php foreach ($model->activeComments as $comment){?> | |
97 | + <div class="comments-card-wr style"> | |
98 | + <div class="style comments-card-autor"><?=$comment->name?></div> | |
99 | + <div class="style comments-card-text"><?=$comment->comment?></div> | |
100 | + <div class="style answers-wr"> | |
101 | + <span data-id="<?=$comment->id?>">ะฒัะดะฟะพะฒัััะธ</span> | |
85 | 102 | </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> | |
103 | + <?php foreach ($comment->activeComments as $child){?> | |
104 | + <div class="comments-card-ansvers-text-wr style"> | |
105 | + <div class="style comments-card-autor-ansvers comments-card-autor"><?=$child->name?></div> | |
106 | + <div class="comments-card-text style"> | |
107 | + <?=$child->comment?> | |
108 | + </div> | |
137 | 109 | </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 | - ?> | |
110 | + <?php } ?> | |
111 | + </div> | |
112 | + <?php } ?> | |
113 | + </div> | |
114 | + <?php } ?> | |
162 | 115 | </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> | |
116 | + <div class="col-xs-12 hidden-sm col-md-1"></div> | |
117 | + <div class="col-xs-12 col-sm-6 col-md-5"> | |
118 | + <div class="style card-form-add-wrapp"> | |
119 | + <?php $module->renderForm($this)?> | |
186 | 120 | </div> |
187 | - | |
188 | - <?= BlogSearch::widget(); ?> | |
189 | - | |
190 | - <div class="panel sidebar-menu"> | |
191 | - <div class="panel-heading"> | |
192 | - <h3 class="panel-title">ะะพะธัะบ ะฟะพ ัะตะณะฐะผ</h3> | |
121 | + </div> | |
122 | + <div class="col-xs-12 border-blog-comments"></div> | |
123 | + </div> | |
124 | + <?php if (!empty($model->relatedBlogArticles)){?> | |
125 | + <div class="row"> | |
126 | + <div class="col-xs-12"> | |
127 | + <div class="read-more-blog-view">ัะธัะฐะนัะต ัะฐะบะพะถ</div> | |
128 | + </div> | |
129 | + </div> | |
130 | + <div class="row"> | |
131 | + <?php foreach ($model->relatedBlogArticles as $article){?> | |
132 | + <div class="col-xs-12 col-sm-4 items-blog-view-wr"> | |
133 | + <div class="items-blog-view"> | |
134 | + <div class="style icons-blog-wr"> | |
135 | + <span><?=date('d.m.Y', $article->created_at)?></span> | |
136 | + <span><?=$article->view?></span> | |
137 | + <span>48</span> | |
193 | 138 | </div> |
194 | - | |
195 | - <div class="panel-body"> | |
196 | - <ul class="tag-cloud"> | |
197 | - <?php foreach ($tags as $tag) { ?> | |
198 | - <li><a href="<?= Url::to( | |
199 | - [ | |
200 | - 'alias' => $tag->alias | |
201 | - ] | |
202 | - ) ?>"><i class="fa fa-tags"></i> <?= $tag->label; ?></a> | |
203 | - </li> | |
204 | - <?php } ?> | |
205 | - </ul> | |
139 | + <a class="title-items-blog-view" href="<?=Url::to(['alias' => $article->language->alias])?>"> | |
140 | + <?=ImageHelper::set((!empty($article->image)) ? $article->image->getUrl() : null)->cropResize(360, 207)->renderImage()?> | |
141 | + | |
142 | + <p><?=$article->language->title?></p> | |
143 | + </a> | |
144 | + <?php if (!empty($article->tags)){?> | |
145 | + <div class="style items-blog-tags"> | |
146 | + <?php foreach ($article->tags as $tag){?> | |
147 | + <a href="<?=Url::to(['alias' => $tag->language->alias])?>"><?=$tag->language->label?></a> | |
148 | + <?php } ?> | |
206 | 149 | </div> |
150 | + <?php } ?> | |
207 | 151 | </div> |
208 | - | |
209 | - <!-- *** MENUS AND FILTERS END *** --> | |
210 | - | |
211 | 152 | </div> |
212 | - <!-- /.col-md-3 --> | |
213 | - <!-- *** RIGHT COLUMN END *** --> | |
214 | - | |
215 | - | |
153 | + <?php } ?> | |
216 | 154 | </div> |
217 | - <!-- /.row --> | |
218 | - | |
155 | + <?php } ?> | |
219 | 156 | </div> |
220 | - <!-- /.container --> | |
221 | -</div> | |
157 | +</section> | |
222 | 158 | <!-- /#content --> |
223 | 159 | |
224 | 160 | \ No newline at end of file | ... | ... |
frontend/views/book/view.php
... | ... | @@ -18,10 +18,14 @@ |
18 | 18 | * @var \artbox\core\forms\Module $moduleAnswer |
19 | 19 | */ |
20 | 20 | $module = \Yii::$app->getModule('comments'); |
21 | - $module->inputOptions += ['book_id' => [ | |
21 | + $module->inputOptions += ['entity_id' => [ | |
22 | 22 | 'type' => 'hiddenInput', |
23 | 23 | 'options' => ['value' => $model->id], |
24 | 24 | ]]; |
25 | + $module->inputOptions += ['entity' => [ | |
26 | + 'type' => 'hiddenInput', | |
27 | + 'options' => ['value' => \common\models\Book::class], | |
28 | + ]]; | |
25 | 29 | $module->inputOptions += ['parent_id' => [ |
26 | 30 | 'type' => 'hiddenInput', |
27 | 31 | 'options' => ['value' => ''], | ... | ... |
frontend/views/site/index.php
... | ... | @@ -88,7 +88,7 @@ |
88 | 88 | <div class="row"> |
89 | 89 | <?php foreach($articles as $article){?> |
90 | 90 | <div class="col-xs-12 col-sm-4 box-items-news"> |
91 | - <a href="#"> | |
91 | + <a href="<?=Url::to(['alias' => $article->language->alias])?>"> | |
92 | 92 | <div class="box-items-news-img"> |
93 | 93 | <!--360x230--> |
94 | 94 | <?php echo ImageHelper::set(!empty($article->image ? $article->image->getPath() : null))->cropResize(360, 230)->renderImage() | ... | ... |