Frontend: Re-add download file action #356

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
Michael Mayer 2020-06-30 18:35:42 +02:00
parent 1eed08f618
commit bf6d9629d4
2 changed files with 16 additions and 1 deletions

View file

@ -61,7 +61,7 @@
<td>
<translate>Name</translate>
</td>
<td>{{ file.Name }}</td>
<td @click.stop.prevent="download(file)" class="clickable">{{ file.Name }}</td>
</tr>
<tr v-if="file.OriginalName">
<td>
@ -172,6 +172,9 @@
openFile(file) {
this.$viewer.show([Thumb.fromFile(this.model, file)], 0);
},
download(file) {
file.download();
},
ungroup(file) {
this.model.ungroupFile(file.UID);
},

View file

@ -112,6 +112,18 @@ export class File extends RestModel {
return "/api/v1/dl/" + this.Hash + "?t=" + config.downloadToken();
}
download() {
if (!this.Hash) {
console.warn("no file hash found for download", this);
return;
}
let link = document.createElement("a");
link.href = this.getDownloadUrl()
link.download = this.baseName(this.Name);
link.click();
}
thumbnailSrcset() {
const result = [];