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