viewer: DL button

pull/175/head
Varun Patil 2022-11-05 17:24:40 -07:00 committed by Varun Patil
parent e276f51fc1
commit 5387586c7a
1 changed files with 20 additions and 1 deletions

View File

@ -2,7 +2,7 @@
<div class="memories_viewer outer" v-if="show">
<div class="inner" ref="inner">
<div class="top-bar" v-if="photoswipe" :class="{ opened }">
<NcActions :inline="2" container=".memories_viewer .pswp">
<NcActions :inline="3" container=".memories_viewer .pswp">
<NcActionButton
:aria-label="t('memories', 'Delete')"
@click="deleteCurrent"
@ -22,6 +22,16 @@
<StarOutlineIcon v-else :size="24" />
</template>
</NcActionButton>
<NcActionButton
:aria-label="t('memories', 'Download')"
@click="downloadCurrent"
:close-after-click="true"
>
{{ t("memories", "Download") }}
<template #icon>
<DownloadIcon :size="24" />
</template>
</NcActionButton>
</NcActions>
</div>
</div>
@ -46,6 +56,7 @@ import "photoswipe/style.css";
import DeleteIcon from "vue-material-design-icons/Delete.vue";
import StarIcon from "vue-material-design-icons/Star.vue";
import StarOutlineIcon from "vue-material-design-icons/StarOutline.vue";
import DownloadIcon from "vue-material-design-icons/Download.vue";
@Component({
components: {
@ -54,6 +65,7 @@ import StarOutlineIcon from "vue-material-design-icons/StarOutline.vue";
DeleteIcon,
StarIcon,
StarOutlineIcon,
DownloadIcon,
},
})
export default class Viewer extends Mixins(GlobalMixin) {
@ -372,6 +384,13 @@ export default class Viewer extends Mixins(GlobalMixin) {
photo.flag &= ~this.c.FLAG_IS_FAVORITE;
}
}
/** Download the current photo */
private async downloadCurrent() {
const photo = this.getCurrentPhoto();
if (!photo) return;
dav.downloadFilesByIds([photo]);
}
}
</script>