From d869a9836ecd55c41039eed00af5ef9198a5e4fa Mon Sep 17 00:00:00 2001 From: advplyr Date: Tue, 3 May 2022 17:21:22 -0500 Subject: [PATCH] Add:More menu for podcast episode cards with Mark as Finished and Edit Podcast #559 --- client/components/app/BookShelfRow.vue | 12 ++++++------ client/components/cards/LazyBookCard.vue | 25 ++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/client/components/app/BookShelfRow.vue b/client/components/app/BookShelfRow.vue index d402b90e..8fa90ee8 100644 --- a/client/components/app/BookShelfRow.vue +++ b/client/components/app/BookShelfRow.vue @@ -4,12 +4,12 @@
@@ -101,10 +101,10 @@ export default { this.selectedAuthor = author this.showAuthorModal = true }, - editBook(audiobook) { - var bookIds = this.shelf.entities.map((e) => e.id) - this.$store.commit('setBookshelfBookIds', bookIds) - this.$store.commit('showEditModal', audiobook) + editItem(libraryItem) { + var itemIds = this.shelf.entities.map((e) => e.id) + this.$store.commit('setBookshelfBookIds', itemIds) + this.$store.commit('showEditModal', libraryItem) }, editEpisode({ libraryItem, episode }) { this.$store.commit('setSelectedLibraryItem', libraryItem) diff --git a/client/components/cards/LazyBookCard.vue b/client/components/cards/LazyBookCard.vue index 65f48fcb..24f2cc86 100644 --- a/client/components/cards/LazyBookCard.vue +++ b/client/components/cards/LazyBookCard.vue @@ -60,7 +60,8 @@ {{ selected ? 'radio_button_checked' : 'radio_button_unchecked' }}
- @@ -345,6 +346,19 @@ export default { return this.store.getters['user/getIsRoot'] }, moreMenuItems() { + if (this.recentEpisode) { + return [ + { + func: 'editPodcast', + text: 'Edit Podcast' + }, + { + func: 'toggleFinished', + text: `Mark as ${this.itemIsFinished ? 'Not Finished' : 'Finished'}` + } + ] + } + var items = [] if (!this.isPodcast) { items = [ @@ -447,10 +461,14 @@ export default { isFinished: !this.itemIsFinished } this.isProcessingReadUpdate = true + + var apiEndpoint = `/api/me/progress/${this.libraryItemId}` + if (this.recentEpisode) apiEndpoint += `/${this.recentEpisode.id}` + var toast = this.$toast || this.$nuxt.$toast var axios = this.$axios || this.$nuxt.$axios axios - .$patch(`/api/me/progress/${this.libraryItemId}`, updatePayload) + .$patch(apiEndpoint, updatePayload) .then(() => { this.isProcessingReadUpdate = false toast.success(`Item marked as ${updatePayload.isFinished ? 'Finished' : 'Not Finished'}`) @@ -461,6 +479,9 @@ export default { toast.error(`Failed to mark as ${updatePayload.isFinished ? 'Finished' : 'Not Finished'}`) }) }, + editPodcast() { + this.$emit('editPodcast', this.libraryItem) + }, rescan() { this.rescanning = true this.$axios