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 { ...@@ -118,7 +118,7 @@ export default {
if (el && this.form[el]) { if (el && this.form[el]) {
this.form[el].value = this.form[el].value =
el === "attachment_file" 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]; : attachmentForm[el];
} }
} }
...@@ -140,12 +140,10 @@ export default { ...@@ -140,12 +140,10 @@ export default {
}, },
onFileChange(e) { onFileChange(e) {
const files = e.target.files || e.dataTransfer.files; const files = e.target.files || e.dataTransfer.files;
console.log(e, files);
if (!files.length) return; if (!files.length) return;
this.fileToImport = files[0]; this.fileToImport = files[0]; //* store file to import
this.form.attachment_file.value = files[0].name; 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.updateStore();
//this.$store.commit("feature_type/SET_FILE_TO_IMPORT", this.fileToImport);
}, },
}, },
......
...@@ -181,17 +181,21 @@ ...@@ -181,17 +181,21 @@
<a <a
class="ui tiny image" class="ui tiny image"
target="_blank" target="_blank"
:href="pj.attachment_file.url" :href="DJANGO_BASE_URL + pj.attachment_file"
> >
<!-- // ? que faire avec un pdf ? --> <img
<img v-if="pj.extension === '.pdf'" src="@/assets/img/pdf.png" /> :src="
<img v-else :src="DJANGO_BASE_URL + pj.attachment_file" /> pj.extension === '.pdf'
? require('@/assets/img/pdf.png')
: DJANGO_BASE_URL + pj.attachment_file
"
/>
</a> </a>
<div class="middle aligned content"> <div class="middle aligned content">
<a <a
class="header" class="header"
target="_blank" target="_blank"
:href="DJANGO_BASE_URL + pj.attachment_file.url" :href="DJANGO_BASE_URL + pj.attachment_file"
>{{ pj.title }}</a >{{ pj.title }}</a
> >
<div class="description"> <div class="description">
...@@ -271,10 +275,6 @@ ...@@ -271,10 +275,6 @@
method="POST" method="POST"
enctype="multipart/form-data" 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 <div
v-if="comment_form.non_field_errors" v-if="comment_form.non_field_errors"
class="alert alert-danger" 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