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

adapt link on attachment thumbnail

parent 01b63128
No related branches found
No related tags found
No related merge requests found
......@@ -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);
},
},
......
......@@ -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"
......
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