Skip to content
Snippets Groups Projects
Commit 94265050 authored by Timothee P's avatar Timothee P :sunflower:
Browse files

WIP

parent 210a4857
No related branches found
No related tags found
2 merge requests!2132.3.2-rc1,!203REDMINE_ISSUE-12652
...@@ -244,8 +244,6 @@ ...@@ -244,8 +244,6 @@
<form <form
id="form-comment" id="form-comment"
class="ui form" class="ui form"
method="POST"
enctype="multipart/form-data"
> >
<div class="required field"> <div class="required field">
<label :for="comment_form.comment.id_for_label" <label :for="comment_form.comment.id_for_label"
...@@ -280,12 +278,12 @@ ...@@ -280,12 +278,12 @@
</div> </div>
<div class="field"> <div class="field">
<input <input
v-model="comment_form.title.value" v-model="comment_form.attachment_file.title"
type="text" type="text"
:name="comment_form.title.html_name" name="title"
:id="comment_form.title.id_for_label" id="title"
/> />
{{ comment_form.title.errors }} {{ comment_form.attachment_file.errors }}
</div> </div>
</div> </div>
<ul v-if="comment_form.attachment_file.errors" class="errorlist"> <ul v-if="comment_form.attachment_file.errors" class="errorlist">
...@@ -351,12 +349,6 @@ import { mapUtil } from "@/assets/js/map-util.js"; ...@@ -351,12 +349,6 @@ import { mapUtil } from "@/assets/js/map-util.js";
import featureAPI from "@/services/feature-api"; import featureAPI from "@/services/feature-api";
import axios from '@/axios-client.js'; import axios from '@/axios-client.js';
// axios.defaults.headers.common['X-CSRFToken'] = (name => {
// var re = new RegExp(name + "=([^;]+)");
// var value = re.exec(document.cookie);
// return (value !== null) ? unescape(value[1]) : null;
// })('csrftoken');
export default { export default {
name: "Feature_detail", name: "Feature_detail",
...@@ -372,14 +364,9 @@ export default { ...@@ -372,14 +364,9 @@ export default {
comment_form: { comment_form: {
attachment_file: { attachment_file: {
errors: null, errors: null,
value: null, title: "",
file: null, file: null,
}, type: "",
title: {
id_for_label: "title",
html_name: "title",
errors: null,
value: null,
}, },
comment: { comment: {
id_for_label: "add-comment", id_for_label: "add-comment",
...@@ -387,7 +374,6 @@ export default { ...@@ -387,7 +374,6 @@ export default {
errors: null, errors: null,
value: null, value: null,
}, },
non_field_errors: [],
}, },
}; };
}, },
...@@ -479,9 +465,9 @@ export default { ...@@ -479,9 +465,9 @@ export default {
.postCommentAttachment({ .postCommentAttachment({
featureId: this.$route.params.slug_signal, featureId: this.$route.params.slug_signal,
file: this.comment_form.attachment_file.file, file: this.comment_form.attachment_file.file,
fileName: this.comment_form.title.file, fileName: this.comment_form.attachment_file.title,
commentId: response.data.id, commentId: response.data.id,
title: response.data.comment, title: this.comment_form.attachment_file.title,
}) })
.then(() => { .then(() => {
this.confirmComment(); this.confirmComment();
...@@ -496,9 +482,7 @@ export default { ...@@ -496,9 +482,7 @@ export default {
this.$store.commit("DISPLAY_MESSAGE", "Ajout du commentaire confirmé"); this.$store.commit("DISPLAY_MESSAGE", "Ajout du commentaire confirmé");
this.getFeatureEvents(); //* display new comment on the page this.getFeatureEvents(); //* display new comment on the page
this.comment_form.attachment_file.file = null; this.comment_form.attachment_file.file = null;
this.comment_form.attachment_file.value = null; this.comment_form.attachment_file.title = null;
this.comment_form.title.file = null;
this.comment_form.title.value = null;
this.comment_form.comment.value = null; this.comment_form.comment.value = null;
}, },
...@@ -528,8 +512,8 @@ export default { ...@@ -528,8 +512,8 @@ export default {
const fileExtension = files[0].name.substring(period + 1); const fileExtension = files[0].name.substring(period + 1);
const shortName = fileName.slice(0, 10) + "[...]." + fileExtension; const shortName = fileName.slice(0, 10) + "[...]." + fileExtension;
_this.comment_form.attachment_file.file = files[0]; //* store the file to post later _this.comment_form.attachment_file.file = files[0]; //* store the file to post later
_this.comment_form.attachment_file.value = shortName; //* for display _this.comment_form.attachment_file.type = fileExtension; //* for adding to fileName
_this.comment_form.title.value = shortName; _this.comment_form.attachment_file.title = shortName; //* for display
_this.comment_form.attachment_file.errors = null; _this.comment_form.attachment_file.errors = null;
} else { } else {
_this.comment_form.attachment_file.errors = _this.comment_form.attachment_file.errors =
......
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