Adds additional button to menu

Signed-off-by: Alexander Saltykov <temp.kroogi@gmail.com>
pull/752/head
Alexander Saltykov 2023-07-28 08:59:19 +03:00
parent cb78e654b0
commit 67da46f6dd
2 changed files with 23 additions and 1 deletions

View File

@ -128,7 +128,7 @@
e.preventDefault(); e.preventDefault();
}, },
async addToAlbum() { addToAlbum() {
(<any>this.$refs.addToAlbumModal).open([{ (<any>this.$refs.addToAlbumModal).open([{
fileid: this.photo.id, fileid: this.photo.id,
basename: this.photo.name, basename: this.photo.name,

View File

@ -136,6 +136,17 @@
<EditFileIcon :size="24" /> <EditFileIcon :size="24" />
</template> </template>
</NcActionButton> </NcActionButton>
<NcActionButton
:aria-label="t('memories', 'Add to album')"
v-if="canEdit"
@click="addToAlbum"
:close-after-click="true"
>
{{ t('memories', 'Add to album') }}
<template #icon>
<AlbumIcon :size="24" />
</template>
</NcActionButton>
</NcActions> </NcActions>
</div> </div>
@ -151,6 +162,7 @@
</div> </div>
</div> </div>
</div> </div>
<AddToAlbumModal ref="addToAlbumModal" />
</div> </div>
</template> </template>
@ -179,6 +191,7 @@ import 'photoswipe/style.css';
import PsImage from './PsImage'; import PsImage from './PsImage';
import PsVideo from './PsVideo'; import PsVideo from './PsVideo';
import PsLivePhoto from './PsLivePhoto'; import PsLivePhoto from './PsLivePhoto';
import AddToAlbumModal from '../modal/AddToAlbumModal.vue';
import ShareIcon from 'vue-material-design-icons/ShareVariant.vue'; import ShareIcon from 'vue-material-design-icons/ShareVariant.vue';
import DeleteIcon from 'vue-material-design-icons/TrashCanOutline.vue'; import DeleteIcon from 'vue-material-design-icons/TrashCanOutline.vue';
@ -192,6 +205,7 @@ import SlideshowIcon from 'vue-material-design-icons/PlayBox.vue';
import EditFileIcon from 'vue-material-design-icons/FileEdit.vue'; import EditFileIcon from 'vue-material-design-icons/FileEdit.vue';
import AlbumRemoveIcon from 'vue-material-design-icons/BookRemove.vue'; import AlbumRemoveIcon from 'vue-material-design-icons/BookRemove.vue';
import LivePhotoIcon from 'vue-material-design-icons/MotionPlayOutline.vue'; import LivePhotoIcon from 'vue-material-design-icons/MotionPlayOutline.vue';
import AlbumIcon from 'vue-material-design-icons/ImageAlbum.vue';
const SLIDESHOW_MS = 5000; const SLIDESHOW_MS = 5000;
const BODY_HAS_VIEWER = 'has-viewer'; const BODY_HAS_VIEWER = 'has-viewer';
@ -216,6 +230,8 @@ export default defineComponent({
EditFileIcon, EditFileIcon,
AlbumRemoveIcon, AlbumRemoveIcon,
LivePhotoIcon, LivePhotoIcon,
AlbumIcon,
AddToAlbumModal,
}, },
mixins: [UserConfig], mixins: [UserConfig],
@ -1123,6 +1139,12 @@ export default defineComponent({
editMetadata() { editMetadata() {
globalThis.editMetadata([globalThis.currentViewerPhoto]); globalThis.editMetadata([globalThis.currentViewerPhoto]);
}, },
addToAlbum() {
if (this.currentPhoto) {
(<any>this.$refs.addToAlbumModal).open([this.currentPhoto]);
}
},
}, },
}); });
</script> </script>