Commit 282b6e56fd494dd8d081bb722658645eb672d4e2

Authored by Yarik
1 parent d94430d1

Commit

common/modules/comment/Controller.php
@@ -65,7 +65,7 @@ @@ -65,7 +65,7 @@
65 if($model->rating->save()) { 65 if($model->rating->save()) {
66 return [ 66 return [
67 'result' => [ 67 'result' => [
68 - 'text' => 'Comment successfully updated', 68 + 'text' => 'Мнение успешно отредактировано',
69 'html' => $this->renderAjax('@common/modules/comment/widgets/views/_review_comment_view', [ 'model' => $model ]), 69 'html' => $this->renderAjax('@common/modules/comment/widgets/views/_review_comment_view', [ 'model' => $model ]),
70 ], 70 ],
71 ]; 71 ];
common/modules/comment/models/Comment.php
@@ -209,7 +209,7 @@ @@ -209,7 +209,7 @@
209 $this->addError('comment_id', 'Comment ID not found'); 209 $this->addError('comment_id', 'Comment ID not found');
210 return false; 210 return false;
211 } else { 211 } else {
212 - if($this->update()) { 212 + if($this->update() !== false) {
213 // $this->clearSafe(); Clears safe attributes after AJAX update 213 // $this->clearSafe(); Clears safe attributes after AJAX update
214 return true; 214 return true;
215 } else { 215 } else {
common/modules/comment/widgets/views/_review_comment_view.php
@@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
15 * @var User $user 15 * @var User $user
16 */ 16 */
17 $user = $model->user; 17 $user = $model->user;
18 - $model->buildButtons([ 'delete' ]); 18 + $model->buildButtons([ 'delete', 'update' ]);
19 ?> 19 ?>
20 <div class="comments-name <?= CommentWidget::$baseClass[ 'comment_author' ] ?>"> 20 <div class="comments-name <?= CommentWidget::$baseClass[ 'comment_author' ] ?>">
21 <?= $model->getAuthor(' (Гость)') ?> 21 <?= $model->getAuthor(' (Гость)') ?>
@@ -33,6 +33,9 @@ @@ -33,6 +33,9 @@
33 echo StarRating::widget([ 33 echo StarRating::widget([
34 'name' => 'rating_review_comment', 34 'name' => 'rating_review_comment',
35 'value' => $model->rating->value, 35 'value' => $model->rating->value,
  36 + 'options' => [
  37 + 'id' => 'rating_comment_show_'.$model->rating->rating_id,
  38 + ],
36 'pluginOptions' => [ 39 'pluginOptions' => [
37 'displayOnly' => true, 40 'displayOnly' => true,
38 'min' => 0, 41 'min' => 0,
common/modules/comment/widgets/views/form-comment-review.php
@@ -24,7 +24,11 @@ @@ -24,7 +24,11 @@
24 ?> 24 ?>
25 <div class="new-portf-add-comm style"> 25 <div class="new-portf-add-comm style">
26 <?php 26 <?php
27 - $form = ActiveForm::begin(); 27 + if(!$model->isNewRecord) {
  28 + $form = ActiveForm::begin(['id' => 'artbox-comment-reply']);
  29 + } else {
  30 + $form = ActiveForm::begin();
  31 + }
28 if(!$model->isNewRecord) { 32 if(!$model->isNewRecord) {
29 echo $form->field($model, 'comment_id') 33 echo $form->field($model, 'comment_id')
30 ->hiddenInput() 34 ->hiddenInput()
@@ -34,6 +38,9 @@ @@ -34,6 +38,9 @@
34 echo $form->field(( !empty( $model->rating ) ? $model->rating : $rating ), 'value') 38 echo $form->field(( !empty( $model->rating ) ? $model->rating : $rating ), 'value')
35 ->label(false) 39 ->label(false)
36 ->widget(StarRating::className(), [ 40 ->widget(StarRating::className(), [
  41 + 'options' => [
  42 + 'id' => ((!$model->isNewRecord)?'rating-value-reply':'rating-value'),
  43 + ],
37 'pluginOptions' => [ 44 'pluginOptions' => [
38 'size' => 'xxs', 45 'size' => 'xxs',
39 'step' => 1, 46 'step' => 1,