diff --git a/src/components/feature/FeatureAttachmentForm.vue b/src/components/feature/FeatureAttachmentForm.vue index 898bb52d09377d47e3c42e4e7d035acce7ca5565..f49247a6907496619067fe8d71dcb772692f7a37 100644 --- a/src/components/feature/FeatureAttachmentForm.vue +++ b/src/components/feature/FeatureAttachmentForm.vue @@ -118,7 +118,7 @@ export default { if (el && this.form[el]) { this.form[el].value = el === "attachment_file" - ? attachmentForm[el].split("/").pop() //* keep only the file name + ? attachmentForm[el].split("/").pop() //* keep only the file name, not the path : attachmentForm[el]; } } @@ -140,12 +140,10 @@ export default { }, onFileChange(e) { const files = e.target.files || e.dataTransfer.files; - console.log(e, files); if (!files.length) return; - this.fileToImport = files[0]; - this.form.attachment_file.value = files[0].name; + this.fileToImport = files[0]; //* store file to import + this.form.attachment_file.value = files[0].name; //* add name to the form for display, in order to match format return from API this.updateStore(); - //this.$store.commit("feature_type/SET_FILE_TO_IMPORT", this.fileToImport); }, }, diff --git a/src/views/feature/Feature_detail.vue b/src/views/feature/Feature_detail.vue index 246bebf5fd1859d5e1b719e24de5cc7cc325076d..37883fdb5fd2b49e24967cc22335c5c6374e35ab 100644 --- a/src/views/feature/Feature_detail.vue +++ b/src/views/feature/Feature_detail.vue @@ -181,17 +181,21 @@ <a class="ui tiny image" target="_blank" - :href="pj.attachment_file.url" + :href="DJANGO_BASE_URL + pj.attachment_file" > - <!-- // ? que faire avec un pdf ? --> - <img v-if="pj.extension === '.pdf'" src="@/assets/img/pdf.png" /> - <img v-else :src="DJANGO_BASE_URL + pj.attachment_file" /> + <img + :src=" + pj.extension === '.pdf' + ? require('@/assets/img/pdf.png') + : DJANGO_BASE_URL + pj.attachment_file + " + /> </a> <div class="middle aligned content"> <a class="header" target="_blank" - :href="DJANGO_BASE_URL + pj.attachment_file.url" + :href="DJANGO_BASE_URL + pj.attachment_file" >{{ pj.title }}</a > <div class="description"> @@ -271,10 +275,6 @@ method="POST" enctype="multipart/form-data" > - <!-- action="{% url 'geocontrib:add_comment' slug=feature.project.slug feature_type_slug=feature.feature_type.slug feature_id=feature.feature_id%}" --> - <!-- {% for hidden in comment_form.hidden_fields %} - {{ hidden }} - {% endfor %} --> <div v-if="comment_form.non_field_errors" class="alert alert-danger"