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
No related merge requests found
......@@ -244,8 +244,6 @@
<form
id="form-comment"
class="ui form"
method="POST"
enctype="multipart/form-data"
>
<div class="required field">
<label :for="comment_form.comment.id_for_label"
......@@ -280,12 +278,12 @@
</div>
<div class="field">
<input
v-model="comment_form.title.value"
v-model="comment_form.attachment_file.title"
type="text"
:name="comment_form.title.html_name"
:id="comment_form.title.id_for_label"
name="title"
id="title"
/>
{{ comment_form.title.errors }}
{{ comment_form.attachment_file.errors }}
</div>
</div>
<ul v-if="comment_form.attachment_file.errors" class="errorlist">
......@@ -351,12 +349,6 @@ import { mapUtil } from "@/assets/js/map-util.js";
import featureAPI from "@/services/feature-api";
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 {
name: "Feature_detail",
......@@ -372,14 +364,9 @@ export default {
comment_form: {
attachment_file: {
errors: null,
value: null,
title: "",
file: null,
},
title: {
id_for_label: "title",
html_name: "title",
errors: null,
value: null,
type: "",
},
comment: {
id_for_label: "add-comment",
......@@ -387,7 +374,6 @@ export default {
errors: null,
value: null,
},
non_field_errors: [],
},
};
},
......@@ -479,9 +465,9 @@ export default {
.postCommentAttachment({
featureId: this.$route.params.slug_signal,
file: this.comment_form.attachment_file.file,
fileName: this.comment_form.title.file,
fileName: this.comment_form.attachment_file.title,
commentId: response.data.id,
title: response.data.comment,
title: this.comment_form.attachment_file.title,
})
.then(() => {
this.confirmComment();
......@@ -496,9 +482,7 @@ export default {
this.$store.commit("DISPLAY_MESSAGE", "Ajout du commentaire confirmé");
this.getFeatureEvents(); //* display new comment on the page
this.comment_form.attachment_file.file = null;
this.comment_form.attachment_file.value = null;
this.comment_form.title.file = null;
this.comment_form.title.value = null;
this.comment_form.attachment_file.title = null;
this.comment_form.comment.value = null;
},
......@@ -528,8 +512,8 @@ export default {
const fileExtension = files[0].name.substring(period + 1);
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.value = shortName; //* for display
_this.comment_form.title.value = shortName;
_this.comment_form.attachment_file.type = fileExtension; //* for adding to fileName
_this.comment_form.attachment_file.title = shortName; //* for display
_this.comment_form.attachment_file.errors = null;
} else {
_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