aboutsummaryrefslogtreecommitdiff
path: root/viewer/src/views/layout/top/LayoutCommand.vue
diff options
context:
space:
mode:
authorpacien2022-11-06 20:23:11 +0100
committerGitHub2022-11-06 20:23:11 +0100
commitbb3b0eae37a7214a3a4a6a1e4354e6f082adf15e (patch)
tree2e5436e819f8e93a1115a8142594ca80fd507bc1 /viewer/src/views/layout/top/LayoutCommand.vue
parentf864eeca506331c1dee2cd3f5f0df4fe806f303a (diff)
parentcfbff75f78963e3d24326f731590e78a4d719e9e (diff)
downloadldgallery-bb3b0eae37a7214a3a4a6a1e4354e6f082adf15e.tar.gz
Merge pull request #347 from ldgallery/p_viewer_download_button
viewer/command: add item download button
Diffstat (limited to 'viewer/src/views/layout/top/LayoutCommand.vue')
-rw-r--r--viewer/src/views/layout/top/LayoutCommand.vue37
1 files changed, 33 insertions, 4 deletions
diff --git a/viewer/src/views/layout/top/LayoutCommand.vue b/viewer/src/views/layout/top/LayoutCommand.vue
index 8919da3..85d47b6 100644
--- a/viewer/src/views/layout/top/LayoutCommand.vue
+++ b/viewer/src/views/layout/top/LayoutCommand.vue
@@ -2,7 +2,7 @@
2-- pictures into a searchable web gallery. 2-- pictures into a searchable web gallery.
3-- 3--
4-- Copyright (C) 2019-2022 Guillaume FOUET 4-- Copyright (C) 2019-2022 Guillaume FOUET
5-- 2020 Pacien TRAN-GIRARD 5-- 2020-2022 Pacien TRAN-GIRARD
6-- 6--
7-- This program is free software: you can redistribute it and/or modify 7-- This program is free software: you can redistribute it and/or modify
8-- it under the terms of the GNU Affero General Public License as 8-- it under the terms of the GNU Affero General Public License as
@@ -33,7 +33,24 @@
33 size="lg" 33 size="lg"
34 /> 34 />
35 </LdLink> 35 </LdLink>
36 <LayoutCommandSort :tabindex="20" /> 36
37 <LdLink
38 v-if="itemResourceUrl"
39 :title="t('command.download')"
40 :download="navigation.getFileName(props.item)"
41 :href="itemResourceUrl"
42 :tabindex="20"
43 >
44 <fa-icon
45 :icon="faFileDownload"
46 size="lg"
47 />
48 </LdLink>
49 <LayoutCommandSort
50 v-else
51 :tabindex="20"
52 />
53
37 <LdLink 54 <LdLink
38 :class="{ disabled: isEntryPoint(), [$style.commandSecondary]: true }" 55 :class="{ disabled: isEntryPoint(), [$style.commandSecondary]: true }"
39 :title="t('command.back')" 56 :title="t('command.back')"
@@ -66,22 +83,34 @@
66<script setup lang="ts"> 83<script setup lang="ts">
67import { Item } from '@/@types/gallery'; 84import { Item } from '@/@types/gallery';
68import LdLink from '@/components/LdLink.vue'; 85import LdLink from '@/components/LdLink.vue';
86import { useNavigation } from '@/services/navigation';
87import { useItemResource } from '@/services/ui/ldItemResourceUrl';
69import { useUiStore } from '@/store/uiStore'; 88import { useUiStore } from '@/store/uiStore';
70import { faAngleDoubleLeft, faArrowLeft, faFolder, faLevelUpAlt, faSearch } from '@fortawesome/free-solid-svg-icons'; 89import {
90 faAngleDoubleLeft,
91 faArrowLeft,
92 faFileDownload,
93 faFolder,
94 faLevelUpAlt,
95 faSearch,
96} from '@fortawesome/free-solid-svg-icons';
71import { computedEager } from '@vueuse/shared'; 97import { computedEager } from '@vueuse/shared';
72import { computed } from 'vue'; 98import { computed, PropType, toRef } from 'vue';
73import { useI18n } from 'vue-i18n'; 99import { useI18n } from 'vue-i18n';
74import { useRoute, useRouter } from 'vue-router'; 100import { useRoute, useRouter } from 'vue-router';
75import LayoutCommandSort from './LayoutCommandSort.vue'; 101import LayoutCommandSort from './LayoutCommandSort.vue';
76 102
77const props = defineProps({ 103const props = defineProps({
78 currentItemPath: { type: Array<Item>, required: true }, 104 currentItemPath: { type: Array<Item>, required: true },
105 item: { type: Object as PropType<Item>, required: true },
79}); 106});
80 107
81const { t } = useI18n(); 108const { t } = useI18n();
82const route = useRoute(); 109const route = useRoute();
83const router = useRouter(); 110const router = useRouter();
84const uiStore = useUiStore(); 111const uiStore = useUiStore();
112const navigation = useNavigation();
113const { itemResourceUrl } = useItemResource(toRef(props, 'item'));
85 114
86const commandToggleSearchPanelIcon = computed(() => uiStore.fullWidth ? faSearch : faAngleDoubleLeft); 115const commandToggleSearchPanelIcon = computed(() => uiStore.fullWidth ? faSearch : faAngleDoubleLeft);
87const isRoot = computedEager(() => props.currentItemPath.length <= 1 && !uiStore.searchMode); 116const isRoot = computedEager(() => props.currentItemPath.length <= 1 && !uiStore.searchMode);