Commit 518c4e3f1e0bd2cdb83b8925409c7f87737f983a

Authored by Alexey Boroda
1 parent 59700e2c

-Article with comments ready

backend/config/main.php
1 1 <?php
2 2 use artbox\core\components\SeoUrlManager;
3 3 use artbox\core\models\Page;
4   - use artbox\webcomment\Module;
5 4 use common\components\Sitemap;
6 5  
7 6 $params = array_merge(
... ... @@ -17,11 +16,6 @@
17 16 'basePath' => dirname(__DIR__),
18 17 'controllerNamespace' => 'backend\controllers',
19 18 'bootstrap' => [ 'log' ],
20   - 'modules' => [
21   - 'artbox-comment' => [
22   - 'class' => Module::className(),
23   - ],
24   - ],
25 19 'controllerMap' => [
26 20 'profile' => 'artbox\core\controllers\ProfileController',
27 21 'page' => 'artbox\core\controllers\PageController',
... ...
common/config/main.php
1 1 <?php
2 2 use artbox\core\components\SeoComponent;
  3 + use artbox\webcomment\Module;
3 4  
4 5 $mail = require( 'filedb/mail.php' );
5 6  
6 7 return [
7 8 'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
8 9 'modules' => [
9   - 'imagemanager' => [
  10 + 'imagemanager' => [
10 11 'class' => 'artbox\core\components\imagemanager\Module',
11 12 'canUploadImage' => true,
12 13 'canRemoveImage' => function () {
... ... @@ -17,6 +18,9 @@
17 18 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css',
18 19 ],
19 20 ],
  21 + 'artbox-comment' => [
  22 + 'class' => Module::className(),
  23 + ],
20 24 ],
21 25 'components' => [
22 26 'cache' => [
... ... @@ -24,15 +28,15 @@
24 28 ],
25 29 'i18n' => [
26 30 'translations' => [
27   - 'core' => [
  31 + 'core' => [
28 32 'class' => 'yii\i18n\PhpMessageSource',
29 33 'basePath' => '@artbox/core/messages',
30 34 ],
31   - 'app' => [
  35 + 'app' => [
32 36 'class' => 'yii\i18n\PhpMessageSource',
33 37 'basePath' => '@common/messages',
34 38 ],
35   - 'blog' => [
  39 + 'blog' => [
36 40 'class' => 'yii\i18n\PhpMessageSource',
37 41 'basePath' => '@artbox/weblog/messages',
38 42 ],
... ... @@ -71,7 +75,7 @@
71 75 'port' => '587',
72 76 'encryption' => 'tls',
73 77 ],
74   - 'viewPath' => '@common/mail'
  78 + 'viewPath' => '@common/mail',
75 79 ],
76 80 ],
77 81 ];
... ...
frontend/views/blog/article.php
1 1 <?php
2 2  
  3 + use artbox\webcomment\widgets\CommentWidget;
3 4 use artbox\weblog\models\Article;
4 5 use yii\helpers\Html;
5 6 use yii\web\View;
... ... @@ -38,7 +39,7 @@ _________________________________________________________ --&gt;
38 39 'alias' => $model->category->lang->alias,
39 40 ]
40 41 );
41   - }
  42 + }
42 43 ?> | <?= date(
43 44 'd M, Y',
44 45 $model->created_at
... ... @@ -52,100 +53,117 @@ _________________________________________________________ --&gt;
52 53 </div>
53 54 <!-- /#post-content -->
54 55  
55   -<!-- <div id="comments">-->
56   -<!-- <h4 class="text-uppercase">2 comments</h4>-->
57   -<!-- -->
58   -<!-- -->
59   -<!-- <div class="row comment">-->
60   -<!-- <div class="col-sm-3 col-md-2 text-center-xs">-->
61   -<!-- <p>-->
62   -<!-- <img src="img/blog-avatar2.jpg" class="img-responsive img-circle" alt="">-->
63   -<!-- </p>-->
64   -<!-- </div>-->
65   -<!-- <div class="col-sm-9 col-md-10">-->
66   -<!-- <h5 class="text-uppercase">Julie Alma</h5>-->
67   -<!-- <p class="posted"><i class="fa fa-clock-o"></i> September 23, 2011 at 12:00 am</p>-->
68   -<!-- <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.-->
69   -<!-- Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>-->
70   -<!-- <p class="reply"><a href="#"><i class="fa fa-reply"></i> Reply</a>-->
71   -<!-- </p>-->
72   -<!-- </div>-->
73   -<!-- </div>-->
74   -<!---->
75   -<!-- -->
76   -<!-- -->
77   -<!-- <div class="row comment last">-->
78   -<!-- -->
79   -<!-- <div class="col-sm-3 col-md-2 text-center-xs">-->
80   -<!-- <p>-->
81   -<!-- <img src="img/blog-avatar.jpg" class="img-responsive img-circle" alt="">-->
82   -<!-- </p>-->
83   -<!-- </div>-->
84   -<!-- -->
85   -<!-- <div class="col-sm-9 col-md-10">-->
86   -<!-- <h5 class="text-uppercase">Louise Armero</h5>-->
87   -<!-- <p class="posted"><i class="fa fa-clock-o"></i> September 23, 2012 at 12:00 am</p>-->
88   -<!-- <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.-->
89   -<!-- Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>-->
90   -<!-- <p class="reply"><a href="#"><i class="fa fa-reply"></i> Reply</a>-->
91   -<!-- </p>-->
92   -<!-- </div>-->
93   -<!-- -->
94   -<!-- </div>-->
95   -<!---->
96   -<!-- </div>-->
  56 + <!-- <div id="comments">-->
  57 + <!-- <h4 class="text-uppercase">2 comments</h4>-->
  58 + <!-- -->
  59 + <!-- -->
  60 + <!-- <div class="row comment">-->
  61 + <!-- <div class="col-sm-3 col-md-2 text-center-xs">-->
  62 + <!-- <p>-->
  63 + <!-- <img src="img/blog-avatar2.jpg" class="img-responsive img-circle" alt="">-->
  64 + <!-- </p>-->
  65 + <!-- </div>-->
  66 + <!-- <div class="col-sm-9 col-md-10">-->
  67 + <!-- <h5 class="text-uppercase">Julie Alma</h5>-->
  68 + <!-- <p class="posted"><i class="fa fa-clock-o"></i> September 23, 2011 at 12:00 am</p>-->
  69 + <!-- <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.-->
  70 + <!-- Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>-->
  71 + <!-- <p class="reply"><a href="#"><i class="fa fa-reply"></i> Reply</a>-->
  72 + <!-- </p>-->
  73 + <!-- </div>-->
  74 + <!-- </div>-->
  75 + <!---->
  76 + <!-- -->
  77 + <!-- -->
  78 + <!-- <div class="row comment last">-->
  79 + <!-- -->
  80 + <!-- <div class="col-sm-3 col-md-2 text-center-xs">-->
  81 + <!-- <p>-->
  82 + <!-- <img src="img/blog-avatar.jpg" class="img-responsive img-circle" alt="">-->
  83 + <!-- </p>-->
  84 + <!-- </div>-->
  85 + <!-- -->
  86 + <!-- <div class="col-sm-9 col-md-10">-->
  87 + <!-- <h5 class="text-uppercase">Louise Armero</h5>-->
  88 + <!-- <p class="posted"><i class="fa fa-clock-o"></i> September 23, 2012 at 12:00 am</p>-->
  89 + <!-- <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.-->
  90 + <!-- Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>-->
  91 + <!-- <p class="reply"><a href="#"><i class="fa fa-reply"></i> Reply</a>-->
  92 + <!-- </p>-->
  93 + <!-- </div>-->
  94 + <!-- -->
  95 + <!-- </div>-->
  96 + <!---->
  97 + <!-- </div>-->
97 98  
98 99  
99   -<!-- <div id="comment-form">-->
100   -<!-- -->
101   -<!-- <h4 class="text-uppercase">Leave comment</h4>-->
102   -<!-- -->
103   -<!-- <form>-->
104   -<!-- <div class="row">-->
105   -<!-- -->
106   -<!-- <div class="col-sm-6">-->
107   -<!-- <div class="form-group">-->
108   -<!-- <label for="name">Name <span class="required">*</span>-->
109   -<!-- </label>-->
110   -<!-- <input type="text" class="form-control" id="name">-->
111   -<!-- </div>-->
112   -<!-- </div>-->
113   -<!-- -->
114   -<!-- </div>-->
115   -<!-- -->
116   -<!-- <div class="row">-->
117   -<!-- <div class="col-sm-6">-->
118   -<!-- <div class="form-group">-->
119   -<!-- <label for="email">Email <span class="required">*</span>-->
120   -<!-- </label>-->
121   -<!-- <input type="text" class="form-control" id="email">-->
122   -<!-- </div>-->
123   -<!-- </div>-->
124   -<!-- </div>-->
125   -<!-- -->
126   -<!-- <div class="row">-->
127   -<!-- <div class="col-sm-12">-->
128   -<!-- <div class="form-group">-->
129   -<!-- <label for="comment">Comment <span class="required">*</span>-->
130   -<!-- </label>-->
131   -<!-- <textarea class="form-control" id="comment" rows="4"></textarea>-->
132   -<!-- </div>-->
133   -<!-- </div>-->
134   -<!-- </div>-->
135   -<!-- -->
136   -<!-- <div class="row">-->
137   -<!-- <div class="col-sm-12 text-right">-->
138   -<!-- <button class="btn btn-template-main"><i class="fa fa-comment-o"></i> Post comment</button>-->
139   -<!-- </div>-->
140   -<!-- </div>-->
141   -<!-- -->
142   -<!-- -->
143   -<!-- </form>-->
144   -<!-- -->
145   -<!-- </div>-->
  100 + <!-- <div id="comment-form">-->
  101 + <!-- -->
  102 + <!-- <h4 class="text-uppercase">Leave comment</h4>-->
  103 + <!-- -->
  104 + <!-- <form>-->
  105 + <!-- <div class="row">-->
  106 + <!-- -->
  107 + <!-- <div class="col-sm-6">-->
  108 + <!-- <div class="form-group">-->
  109 + <!-- <label for="name">Name <span class="required">*</span>-->
  110 + <!-- </label>-->
  111 + <!-- <input type="text" class="form-control" id="name">-->
  112 + <!-- </div>-->
  113 + <!-- </div>-->
  114 + <!-- -->
  115 + <!-- </div>-->
  116 + <!-- -->
  117 + <!-- <div class="row">-->
  118 + <!-- <div class="col-sm-6">-->
  119 + <!-- <div class="form-group">-->
  120 + <!-- <label for="email">Email <span class="required">*</span>-->
  121 + <!-- </label>-->
  122 + <!-- <input type="text" class="form-control" id="email">-->
  123 + <!-- </div>-->
  124 + <!-- </div>-->
  125 + <!-- </div>-->
  126 + <!-- -->
  127 + <!-- <div class="row">-->
  128 + <!-- <div class="col-sm-12">-->
  129 + <!-- <div class="form-group">-->
  130 + <!-- <label for="comment">Comment <span class="required">*</span>-->
  131 + <!-- </label>-->
  132 + <!-- <textarea class="form-control" id="comment" rows="4"></textarea>-->
  133 + <!-- </div>-->
  134 + <!-- </div>-->
  135 + <!-- </div>-->
  136 + <!-- -->
  137 + <!-- <div class="row">-->
  138 + <!-- <div class="col-sm-12 text-right">-->
  139 + <!-- <button class="btn btn-template-main"><i class="fa fa-comment-o"></i> Post comment</button>-->
  140 + <!-- </div>-->
  141 + <!-- </div>-->
  142 + <!-- -->
  143 + <!-- -->
  144 + <!-- </form>-->
  145 + <!-- -->
  146 + <!-- </div>-->
146 147 <!-- /#comment-form -->
147   -
148   -
  148 +
  149 + <?php
  150 + echo CommentWidget::widget(
  151 + [
  152 + 'model' => $model,
  153 + 'display_name' => 'name',
  154 + 'reply' => true,
  155 + 'delete' => false,
  156 + 'more' => [
  157 + 'show_' => true,
  158 + 'key' => 2,
  159 + ],
  160 + 'formView' => '@frontend/views/comment/artbox_comment_form',
  161 + 'listView' => '@frontend/views/comment/artbox_comment_list',
  162 + 'replyView' => '@frontend/views/comment/artbox_comment_reply',
  163 + 'itemView' => '@frontend/views/comment/artbox_comment_item',
  164 + ]
  165 + );
  166 + ?>
149 167  
150 168 </div>
151 169 <!-- /#blog-post -->
... ...
frontend/views/comment/artbox_comment_form.php 0 โ†’ 100755
  1 +<?php
  2 + use artbox\webcomment\models\CommentModel;
  3 + use artbox\webcomment\models\RatingModel;
  4 + use yii\base\Model;
  5 + use yii\helpers\Html;
  6 + use yii\helpers\Url;
  7 + use yii\web\View;
  8 + use yii\widgets\ActiveForm;
  9 +
  10 + /**
  11 + * @var CommentModel $comment_model
  12 + * @var array $form_params
  13 + * @var Model $model
  14 + * @var string $formId
  15 + * @var View $this
  16 + * @var RatingModel|NULL $rating_model
  17 + */
  18 + $form = ActiveForm::begin(
  19 + [
  20 + 'id' => $formId,
  21 + 'action' => Url::to(
  22 + [
  23 + 'artbox-comment/default/create',
  24 + 'entity' => $comment_model->encryptedEntity,
  25 + ]
  26 + ),
  27 + ]
  28 + );
  29 +?>
  30 + <div class="form-comm-wr">
  31 + <?php
  32 + if (!empty($rating_model)) {
  33 + ?>
  34 + <div class="input_bl stars-wr_">
  35 + <?php
  36 + echo $form->field($rating_model, 'value', [ 'enableClientValidation' => false ])
  37 + ->hiddenInput()
  38 + ->label(false);
  39 + echo Html::tag(
  40 + 'div',
  41 + '',
  42 + [
  43 + 'class' => 'rateit',
  44 + 'data-rateit-backingfld' => '#' . Html::getInputId($rating_model, 'value'),
  45 + ]
  46 + );
  47 + ?>
  48 + </div>
  49 + <?php
  50 + }
  51 + if (\Yii::$app->user->isGuest) {
  52 + echo $form->field($comment_model, 'username', [ 'options' => [ 'class' => 'form-group input_bl' ] ])
  53 + ->textInput();
  54 + echo $form->field($comment_model, 'email', [ 'options' => [ 'class' => 'form-group input_bl' ] ])
  55 + ->textInput();
  56 + }
  57 + echo $form->field($comment_model, 'text', [ 'options' => [ 'class' => 'form-group input_bl area_bl' ] ])
  58 + ->textarea();
  59 + echo Html::tag(
  60 + 'div',
  61 + Html::submitButton(
  62 + Yii::t('app', 'Submit comment')
  63 + ),
  64 + [ 'class' => 'input_bl submit_btn' ]
  65 + );
  66 + ?>
  67 + </div>
  68 +<?php
  69 + ActiveForm::end();
  70 +?>
0 71 \ No newline at end of file
... ...
frontend/views/comment/artbox_comment_item.php 0 โ†’ 100755
  1 +<?php
  2 + use artbox\webcomment\models\CommentModel;
  3 + use yii\helpers\Html;
  4 + use yii\helpers\Url;
  5 + use yii\widgets\ListView;
  6 +
  7 + /**
  8 + * @var CommentModel $model
  9 + * @var mixed $key
  10 + * @var int $index
  11 + * @var ListView $widget
  12 + * @var string $display_name
  13 + * @var array $more
  14 + */
  15 +
  16 +?>
  17 +
  18 +<div class="comments-wr">
  19 + <div class="artbox_item_info">
  20 + <div class="user-ico">
  21 + <?php
  22 + echo mb_substr($model->username, 0,1);
  23 + ?>
  24 + </div>
  25 + <div class="user_data" itemprop="datePublished">
  26 + <?php
  27 + echo date('d.m.Y', $model->created_at);
  28 + ?>
  29 + </div>
  30 + <div class="user_name" itemprop="author">
  31 + <?php
  32 + $nameField = $display_name;
  33 + echo $model->username . ' (' . Yii::t('artbox-comment', 'Guest') . ')';
  34 + ?>
  35 + </div>
  36 + <?php
  37 + if (!empty($model->rating)) {
  38 + ?>
  39 + <div class="user_rating" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
  40 + <span itemprop="worstRating" style="display: none">1</span>
  41 + <span itemprop="ratingValue" style="display: none"><?php echo $model->rating->value; ?></span>
  42 + <span itemprop="bestRating" style="display: none">5</span>
  43 + <div class="rateit" data-rateit-value="<?php echo $model->rating->value; ?>" data-rateit-ispreset="true" data-rateit-readonly="true"></div>
  44 + </div>
  45 + <?php
  46 + }
  47 + ?>
  48 + <div class="user_txt" itemprop="description">
  49 + <?php
  50 + echo $model->text;
  51 + ?>
  52 + </div>
  53 + </div>
  54 + <div class="artbox_item_tools comment-panel">
  55 + <?php
  56 + if (!\Yii::$app->user->isGuest && $reply && \Yii::$app->user->id != $model->customer_id) {
  57 + ?>
  58 + <a href="" class="btn-comm-answer" data-action="reply"><?php echo \Yii::t(
  59 + 'artbox-comment',
  60 + 'ะžั‚ะฒะตั‚ะธั‚ัŒ'
  61 + ); ?></a>
  62 + <?php
  63 + }
  64 + if (!\Yii::$app->user->isGuest && \Yii::$app->user->id == $model->customer_id && $delete) {
  65 + ?>
  66 + <a href="" class="btn-comm-delete" data-action="delete" data-url="<?php echo Url::to(
  67 + [
  68 + 'artbox-comment/default/delete',
  69 + 'id' => $model->id,
  70 + ]
  71 + ); ?>"><?php echo \Yii::t('artbox-comment', 'ะฃะดะฐะปะธั‚ัŒ'); ?></a>
  72 + <?php
  73 + }
  74 + // Like / dislike to be done
  75 + /*
  76 + ?>
  77 + <a href="" class="btn-comm-like" data-action="like" data-url="<?php echo Url::to([
  78 + 'artbox-comment/default/like',
  79 + 'id' => $model->artbox_comment_id,
  80 + ]); ?>">Like</a>
  81 + <a href="" class="btn-comm-dislike" data-action="dislike" data-url="<?php echo Url::to([
  82 + 'artbox-comment/default/dislike',
  83 + 'id' => $model->artbox_comment_id,
  84 + ]); ?>">Dislike</a>
  85 + <?php
  86 + */
  87 + ?>
  88 + <div class="artbox_item_reply"></div>
  89 + </div>
  90 +</div>
  91 +<div class="artbox_children_container">
  92 + <?php
  93 + if (!empty($model->children)) {
  94 + foreach ($model->children as $index => $child) {
  95 + ?>
  96 + <div class="artbox_child_container comment-answer" data-key="<?php echo $child->id; ?>">
  97 + <div class="artbox_child_info">
  98 + <div class="user-ico">
  99 + <?php
  100 + echo Html::img('/img/no-image.png');
  101 + ?>
  102 + </div>
  103 + <div class="user_data">
  104 + <?php
  105 + echo date('d.m.Y', $child->created_at);
  106 + ?>
  107 + </div>
  108 + <div class="user_name">
  109 + <?php
  110 + $nameField = $display_name;
  111 + if (!empty($child->customer)) {
  112 + echo $child->customer->$nameField;
  113 + } else {
  114 + echo $child->username . ' (' . Yii::t('artbox-comment', 'Guest') . ')';
  115 + }
  116 + ?>
  117 + </div>
  118 + <div class="user_txt">
  119 + <?php
  120 + echo $child->text;
  121 + ?>
  122 + </div>
  123 + </div>
  124 + <div class="artbox_child_tools comment-panel">
  125 + <?php
  126 + if (!\Yii::$app->user->isGuest && $reply && \Yii::$app->user->id != $child->customer_id) {
  127 + ?>
  128 + <a href="" class="btn-comm-answer" data-action="reply"><?php echo \Yii::t(
  129 + 'artbox-comment',
  130 + 'ะžั‚ะฒะตั‚ะธั‚ัŒ'
  131 + ); ?></a>
  132 + <?php
  133 + }
  134 + if (!\Yii::$app->user->isGuest && \Yii::$app->user->id == $child->customer_id && $delete) {
  135 + ?>
  136 + <a href="" class="btn-comm-delete" data-action="delete" data-url="<?php echo Url::to(
  137 + [
  138 + 'artbox-comment/default/delete',
  139 + 'id' => $child->id,
  140 + ]
  141 + ); ?>"><?php echo \Yii::t('artbox-comment', 'ะฃะดะฐะปะธั‚ัŒ'); ?></a>
  142 + <?php
  143 + }
  144 + /* Like /dislike to be done
  145 + ?>
  146 + <a href="" class="btn-comm-like" data-action="like" data-url="<?php echo Url::to([
  147 + 'artbox-comment/default/like',
  148 + 'id' => $child->artbox_comment_id,
  149 + ]); ?>">Like</a>
  150 + <a href="" class="btn-comm-dislike" data-action="dislike" data-url="<?php echo Url::to([
  151 + 'artbox-comment/default/dislike',
  152 + 'id' => $child->artbox_comment_id,
  153 + ]); ?>">Dislike</a>
  154 + <?php
  155 + */
  156 + ?>
  157 + <div class="artbox_child_reply"></div>
  158 + </div>
  159 + </div>
  160 + <?php
  161 + }
  162 + }
  163 + ?>
  164 +</div>
  165 +
  166 +
... ...
frontend/views/comment/artbox_comment_list.php 0 โ†’ 100755
  1 +<?php
  2 + use artbox\webcomment\models\CommentModel;
  3 + use yii\base\Model;
  4 + use yii\data\ActiveDataProvider;
  5 + use yii\helpers\Html;
  6 + use yii\web\View;
  7 + use yii\widgets\ListView;
  8 + use yii\widgets\Pjax;
  9 +
  10 + /**
  11 + * @var CommentModel $comment_model
  12 + * @var array $list_params
  13 + * @var array $item_options
  14 + * @var string $item_view
  15 + * @var Model $model
  16 + * @var ActiveDataProvider $comments
  17 + * @var View $this
  18 + * @var string $display_name
  19 + * @var boolean $reply ,
  20 + * @var boolean $delete
  21 + */
  22 + Pjax::begin();
  23 + if(( $success = \Yii::$app->session->getFlash('artbox_comment_success') ) != NULL) {
  24 + echo Html::tag('p', $success);
  25 + }
  26 + echo ListView::widget([
  27 + 'dataProvider' => $comments,
  28 + 'itemOptions' => $item_options,
  29 + 'itemView' => $item_view,
  30 + 'emptyText' => false,
  31 + 'summary' => '',
  32 + 'viewParams' => [
  33 + 'display_name' => $display_name,
  34 + 'reply' => $reply,
  35 + 'delete' => $delete,
  36 + 'more' => $more,
  37 + 'last' => $comments->count,
  38 + ],
  39 + 'beforeItem' => function ($model, $key, $index, $widget) use ($more, $comments) {
  40 + if ($more['key'] == $index and $more['show_'] ){
  41 +
  42 + return "<a id='show_more_link' style='cursor:pointer'>ะŸะพะบะฐะทะฐั‚ัŒ ะตั‰ะต</a>
  43 + <div id='show_more' style='display: none'>";
  44 + }
  45 + },
  46 + 'afterItem' => function ($model, $key, $index, $widget) use ($more, $comments) {
  47 + if ($index == ($comments->count-1) and $more['show_'] and $more['key'] < $comments->count){
  48 +
  49 + return "<a id='hide_more_link' style='cursor:pointer'>ะกะบั€ั‹ั‚ัŒ ะบะพะผะผะตะฝั‚ะฐั€ะธะธ</a></div>";
  50 + }
  51 +}
  52 +
  53 +
  54 + ]);
  55 + Pjax::end();
  56 +
0 57 \ No newline at end of file
... ...
frontend/views/comment/artbox_comment_reply.php 0 โ†’ 100755
  1 +<?php
  2 + use artbox\webcomment\models\CommentModel;
  3 + use yii\base\Model;
  4 + use yii\helpers\Html;
  5 + use yii\helpers\Url;
  6 + use yii\web\View;
  7 + use yii\widgets\ActiveForm;
  8 +
  9 + /**
  10 + * @var CommentModel $comment_model
  11 + * @var array $form_params
  12 + * @var Model $model
  13 + * @var string $formId
  14 + * @var View $this
  15 + */
  16 + $text_input_id = Html::getInputId($comment_model, 'text') . '-reply';
  17 + $parent_id_input_id = Html::getInputId($comment_model, 'parent_id') . '-reply';
  18 + $text_input_selectors = [
  19 + 'container' => '.field-' . $text_input_id,
  20 + 'input' => '#' . $text_input_id,
  21 + ];
  22 + $parent_id_input_selectors = [
  23 + 'container' => '.field-' . $parent_id_input_id,
  24 + 'input' => '#' . $parent_id_input_id,
  25 + ];
  26 + $form = ActiveForm::begin([
  27 + 'id' => $formId . '-reply',
  28 + 'action' => Url::to([
  29 + 'artbox-comment/default/create',
  30 + 'entity' => $comment_model->encryptedEntity,
  31 + ]),
  32 + ]);
  33 +?>
  34 + <div class="answer-form">
  35 + <?php
  36 + echo $form->field(
  37 + $comment_model,
  38 + 'parent_id',
  39 + [
  40 + 'selectors' => $parent_id_input_selectors,
  41 + 'inputOptions' => [
  42 + 'id' => $parent_id_input_id,
  43 + 'class' => 'form-control',
  44 + ],
  45 + ])
  46 + ->hiddenInput()
  47 + ->label(false);
  48 + echo $form->field($comment_model, 'text', [
  49 + 'selectors' => $text_input_selectors,
  50 + 'inputOptions' => [
  51 + 'id' => $text_input_id,
  52 + 'class' => 'form-control',
  53 + 'cols' => 30,
  54 + 'rows' => 10,
  55 + ],
  56 + ])
  57 + ->textarea();
  58 + echo Html::submitButton(Yii::t('artbox-comment', 'Submit'));
  59 + echo Html::button(Yii::t('artbox-comment', 'Cancel'), [ 'data-action' => 'reply-cancel' ]);
  60 + ?>
  61 + </div>
  62 +<?php
  63 + ActiveForm::end();
  64 +?>
0 65 \ No newline at end of file
... ...