diff --git a/common/models/Feedback.php b/common/models/Feedback.php index 80844ea..50b30ad 100644 --- a/common/models/Feedback.php +++ b/common/models/Feedback.php @@ -54,7 +54,7 @@ class Feedback extends \yii\db\ActiveRecord return [ [['name', 'answer', 'email'], 'required'], [['email'], 'email'], - [['phone'], 'match', 'pattern' => '^\+?(?:\d{0,3})?[\(\s]?\d{0,5}[\)\s]?\d{3}[-\s]?\d{2}[-\s]?\d{2}$'], + [['phone'], 'match', 'pattern' => '/^\+?(?:\d{0,3})?[\(\s]?\d{0,5}[\)\s]?\d{3}[-\s]?\d{2}[-\s]?\d{2}$/'], [['name', 'phone', 'answer'], 'string', 'max' => 255], ]; } diff --git a/common/modules/comment/models/CommentProject.php b/common/modules/comment/models/CommentProject.php index f1cd1ec..d35290c 100644 --- a/common/modules/comment/models/CommentProject.php +++ b/common/modules/comment/models/CommentProject.php @@ -342,6 +342,7 @@ return \Yii::$app->user->can(\common\modules\comment\Permissions::CREATE, [ 'model' => $this->model, 'model_id' => $this->model_id, + 'comment_model' => $this->className(), ]); } } diff --git a/common/modules/comment/models/CommentProjectAnswer.php b/common/modules/comment/models/CommentProjectAnswer.php index 2b4c5c5..2d0b4d1 100644 --- a/common/modules/comment/models/CommentProjectAnswer.php +++ b/common/modules/comment/models/CommentProjectAnswer.php @@ -75,6 +75,23 @@ 'model_id' => $this->model_id, ], ], + [ + ['comment_pid'], + 'required', + 'when' => function($model, $attribute) { + /** + * @var CommentProjectAnswer $model + * @var string $attribute + */ + if(!empty(\Yii::$app->user->id) && $model->isNewRecord && !empty($model->model) && !empty($model->model_id)) { + $project = Project::findOne($model->model_id); + if(!empty($project) && $project->user_id == \Yii::$app->user->id) { + return true; + } + } + return false; + } + ], ]; } diff --git a/common/modules/comment/resources/comment.js b/common/modules/comment/resources/comment.js index b689e2f..48ea487 100644 --- a/common/modules/comment/resources/comment.js +++ b/common/modules/comment/resources/comment.js @@ -187,11 +187,14 @@ $(function() { $(document).on('click', '.artbox_comment_reply_answer', function(e) { e.preventDefault(); var widget = $(this).parents('.artbox_comment_widget'); + var form = $(widget).find('.artbox_comment_form'); + $(form).removeClass('hidden'); $(widget).find('.artbox_comment_answer_label').text('Ответ'); }); $(document).on('click', '.artbox_comment_reply_answer_block', function(e) { var form = $(this).parents('.artbox_comment_form'); + $(form).addClass('hidden'); $(form).find('.artbox_comment_answer_label').text('Вопрос'); }); diff --git a/common/modules/comment/widgets/views/_question_comment_view.php b/common/modules/comment/widgets/views/_question_comment_view.php index 84fe00f..c733a62 100644 --- a/common/modules/comment/widgets/views/_question_comment_view.php +++ b/common/modules/comment/widgets/views/_question_comment_view.php @@ -21,8 +21,8 @@ ]); } ?> -
= \Yii::$app->formatter->asDate($model->date_add, 'php:d.m.Y') ?>
+ += \Yii::$app->formatter->asDate($model->date_add, 'php:d.m.Y') ?>