Skip to content
Snippets Groups Projects
Commit 7c20ca33 authored by Sébastien DA ROCHA's avatar Sébastien DA ROCHA :bicyclist:
Browse files

Merge branch 'redmine-issues/12030' into 'develop'

REDMINE_ISSUES-12030

See merge request !200
parents 4b8a7ef8 59bc59b5
No related branches found
No related tags found
2 merge requests!2132.3.2-rc1,!200REDMINE_ISSUES-12030
...@@ -251,7 +251,11 @@ ...@@ -251,7 +251,11 @@
<label :for="comment_form.comment.id_for_label" <label :for="comment_form.comment.id_for_label"
>Ajouter un commentaire</label >Ajouter un commentaire</label
> >
{{ comment_form.comment.errors }} <ul v-if="comment_form.comment.errors" class="errorlist">
<li>
{{ comment_form.comment.errors }}
</li>
</ul>
<textarea <textarea
v-model="comment_form.comment.value" v-model="comment_form.comment.value"
:name="comment_form.comment.html_name" :name="comment_form.comment.html_name"
...@@ -383,7 +387,7 @@ export default { ...@@ -383,7 +387,7 @@ export default {
comment: { comment: {
id_for_label: "add-comment", id_for_label: "add-comment",
html_name: "add-comment", html_name: "add-comment",
errors: null, errors: "",
value: null, value: null,
}, },
non_field_errors: [], non_field_errors: [],
...@@ -466,8 +470,18 @@ export default { ...@@ -466,8 +470,18 @@ export default {
this.addFeatureToMap(); this.addFeatureToMap();
}, },
validateForm() {
this.comment_form.comment.errors = ""
if (!this.comment_form.comment.value) {
this.comment_form.comment.errors = "Le commentaire ne peut pas être vide"
return false;
}
return true;
},
postComment() { postComment() {
featureAPI if (this.validateForm()) {
featureAPI
.postComment({ .postComment({
featureId: this.$route.params.slug_signal, featureId: this.$route.params.slug_signal,
comment: this.comment_form.comment.value, comment: this.comment_form.comment.value,
...@@ -489,6 +503,7 @@ export default { ...@@ -489,6 +503,7 @@ export default {
this.confirmComment(); this.confirmComment();
} }
}); });
}
}, },
confirmComment() { confirmComment() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment