From 282b6e56fd494dd8d081bb722658645eb672d4e2 Mon Sep 17 00:00:00 2001 From: yarik Date: Tue, 30 Aug 2016 19:02:33 +0300 Subject: [PATCH] Commit --- common/modules/comment/Controller.php | 2 +- common/modules/comment/models/Comment.php | 2 +- common/modules/comment/widgets/views/_review_comment_view.php | 5 ++++- common/modules/comment/widgets/views/form-comment-review.php | 9 ++++++++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/common/modules/comment/Controller.php b/common/modules/comment/Controller.php index 1d7e87b..de9b8b5 100755 --- a/common/modules/comment/Controller.php +++ b/common/modules/comment/Controller.php @@ -65,7 +65,7 @@ if($model->rating->save()) { return [ 'result' => [ - 'text' => 'Comment successfully updated', + 'text' => 'Мнение успешно отредактировано', 'html' => $this->renderAjax('@common/modules/comment/widgets/views/_review_comment_view', [ 'model' => $model ]), ], ]; diff --git a/common/modules/comment/models/Comment.php b/common/modules/comment/models/Comment.php index 52d0a4c..985e919 100755 --- a/common/modules/comment/models/Comment.php +++ b/common/modules/comment/models/Comment.php @@ -209,7 +209,7 @@ $this->addError('comment_id', 'Comment ID not found'); return false; } else { - if($this->update()) { + if($this->update() !== false) { // $this->clearSafe(); Clears safe attributes after AJAX update return true; } else { diff --git a/common/modules/comment/widgets/views/_review_comment_view.php b/common/modules/comment/widgets/views/_review_comment_view.php index 2bfaea3..361ed69 100755 --- a/common/modules/comment/widgets/views/_review_comment_view.php +++ b/common/modules/comment/widgets/views/_review_comment_view.php @@ -15,7 +15,7 @@ * @var User $user */ $user = $model->user; - $model->buildButtons([ 'delete' ]); + $model->buildButtons([ 'delete', 'update' ]); ?>
getAuthor(' (Гость)') ?> @@ -33,6 +33,9 @@ echo StarRating::widget([ 'name' => 'rating_review_comment', 'value' => $model->rating->value, + 'options' => [ + 'id' => 'rating_comment_show_'.$model->rating->rating_id, + ], 'pluginOptions' => [ 'displayOnly' => true, 'min' => 0, diff --git a/common/modules/comment/widgets/views/form-comment-review.php b/common/modules/comment/widgets/views/form-comment-review.php index edb80a6..2808057 100755 --- a/common/modules/comment/widgets/views/form-comment-review.php +++ b/common/modules/comment/widgets/views/form-comment-review.php @@ -24,7 +24,11 @@ ?>
isNewRecord) { + $form = ActiveForm::begin(['id' => 'artbox-comment-reply']); + } else { + $form = ActiveForm::begin(); + } if(!$model->isNewRecord) { echo $form->field($model, 'comment_id') ->hiddenInput() @@ -34,6 +38,9 @@ echo $form->field(( !empty( $model->rating ) ? $model->rating : $rating ), 'value') ->label(false) ->widget(StarRating::className(), [ + 'options' => [ + 'id' => ((!$model->isNewRecord)?'rating-value-reply':'rating-value'), + ], 'pluginOptions' => [ 'size' => 'xxs', 'step' => 1, -- libgit2 0.21.4