From 35456c6183c199b23ded85838414eb28a6d4b60f Mon Sep 17 00:00:00 2001 From: pacien Date: Mon, 4 May 2020 00:11:31 +0200 Subject: viewer/LdDownload: add generic file download handler GitHub: closes #209 --- viewer/src/@types/gallery.d.ts | 1 + viewer/src/components/LdDownload.vue | 67 ++++++++++++++++++++++++++++++++++ viewer/src/locales/en.json | 2 +- viewer/src/plugins/fontawesome.ts | 2 + viewer/src/views/GalleryNavigation.vue | 5 +-- 5 files changed, 72 insertions(+), 5 deletions(-) create mode 100644 viewer/src/components/LdDownload.vue (limited to 'viewer') diff --git a/viewer/src/@types/gallery.d.ts b/viewer/src/@types/gallery.d.ts index 066aedf..3246894 100644 --- a/viewer/src/@types/gallery.d.ts +++ b/viewer/src/@types/gallery.d.ts @@ -55,6 +55,7 @@ declare namespace Gallery { } interface OtherProperties { type: "other", + resource: string } interface PictureProperties { type: "picture", diff --git a/viewer/src/components/LdDownload.vue b/viewer/src/components/LdDownload.vue new file mode 100644 index 0000000..3b13e99 --- /dev/null +++ b/viewer/src/components/LdDownload.vue @@ -0,0 +1,67 @@ + + + + + + + diff --git a/viewer/src/locales/en.json b/viewer/src/locales/en.json index c011552..824064e 100644 --- a/viewer/src/locales/en.json +++ b/viewer/src/locales/en.json @@ -7,8 +7,8 @@ "tag-propositions.addition": "Include all items with this tag", "tag-propositions.intersection": "Search for this tag", "tag-propositions.item-count": "Item count", - "gallery.unknown-type": "Could not display item of unknown type", "gallery.unknown-resource": "Resource not found", + "download.download-file-fmt": "Download {0}", "command.search": "Open/close search panel", "command.search.clear": "Clear", "command.search.search": "Search", diff --git a/viewer/src/plugins/fontawesome.ts b/viewer/src/plugins/fontawesome.ts index 933bce6..886d680 100644 --- a/viewer/src/plugins/fontawesome.ts +++ b/viewer/src/plugins/fontawesome.ts @@ -35,6 +35,7 @@ import { faAngleRight, faAngleDoubleLeft, faFile, + faFileDownload, } from "@fortawesome/free-solid-svg-icons"; library.add( @@ -51,6 +52,7 @@ library.add( faAngleRight, faAngleDoubleLeft, faFile, + faFileDownload, ); config.autoAddCss = false; diff --git a/viewer/src/views/GalleryNavigation.vue b/viewer/src/views/GalleryNavigation.vue index 08c8218..2e40409 100644 --- a/viewer/src/views/GalleryNavigation.vue +++ b/viewer/src/views/GalleryNavigation.vue @@ -65,10 +65,7 @@ export default class GalleryNavigation extends Vue { return { component: "ld-picture", properties: { picture: this.$galleryStore.currentItem } }; default: - return { - component: "ld-error", - properties: { icon: "file", message: this.$t("gallery.unknown-type") } - }; + return { component: "ld-download", properties: { item: this.$galleryStore.currentItem } }; } } } -- cgit v1.2.3