diff --git a/client/components/modals/podcast/EpisodeFeed.vue b/client/components/modals/podcast/EpisodeFeed.vue
index 14a81f6e..642a6e0e 100644
--- a/client/components/modals/podcast/EpisodeFeed.vue
+++ b/client/components/modals/podcast/EpisodeFeed.vue
@@ -11,11 +11,11 @@
v-for="(episode, index) in episodes"
:key="index"
class="relative"
- :class="episode.enclosure && itemEpisodeMap[episode.enclosure.url] ? 'bg-primary bg-opacity-40' : selectedEpisodes[String(index)] ? 'cursor-pointer bg-success bg-opacity-10' : index % 2 == 0 ? 'cursor-pointer bg-primary bg-opacity-25 hover:bg-opacity-40' : 'cursor-pointer bg-primary bg-opacity-5 hover:bg-opacity-25'"
- @click="toggleSelectEpisode(index)"
+ :class="itemEpisodeMap[episode.enclosure.url] ? 'bg-primary bg-opacity-40' : selectedEpisodes[String(index)] ? 'cursor-pointer bg-success bg-opacity-10' : index % 2 == 0 ? 'cursor-pointer bg-primary bg-opacity-25 hover:bg-opacity-40' : 'cursor-pointer bg-primary bg-opacity-5 hover:bg-opacity-25'"
+ @click="toggleSelectEpisode(index, episode)"
>
- download_done
+ download_done
@@ -23,20 +23,13 @@
{{ episode.title }}
{{ episode.subtitle }}
Published {{ episode.publishedAt ? $dateDistanceFromNow(episode.publishedAt) : 'Unknown' }}
-
-
-
{{ buttonText }}
+
+
{{ buttonText }}
+
All episodes are downloaded
@@ -58,7 +51,8 @@ export default {
data() {
return {
processing: false,
- selectedEpisodes: {}
+ selectedEpisodes: {},
+ selectAll: false
}
},
watch: {
@@ -78,22 +72,12 @@ export default {
this.$emit('input', val)
}
},
- selectAll: {
- get() {
- return this.episodesSelected.length == this.episodes.filter((_, index) => !(this.episodes[index].enclosure && this.itemEpisodeMap[this.episodes[index].enclosure.url])).length
- },
- set(val) {
- for (const key in this.selectedEpisodes) {
- this.selectedEpisodes[key] = val
- }
- }
- },
title() {
if (!this.libraryItem) return ''
return this.libraryItem.media.metadata.title || 'Unknown'
},
allDownloaded() {
- return Object.values(this.episodes).filter((episode) => !(episode.enclosure && this.itemEpisodeMap[episode.enclosure.url])).length === 0
+ return !this.episodes.some((episode) => !this.itemEpisodeMap[episode.enclosure.url])
},
episodesSelected() {
return Object.keys(this.selectedEpisodes).filter((key) => !!this.selectedEpisodes[key])
@@ -115,8 +99,27 @@ export default {
}
},
methods: {
- toggleSelectEpisode(index) {
+ toggleSelectAll(val) {
+ for (let i = 0; i < this.episodes.length; i++) {
+ const episode = this.episodes[i]
+ if (this.itemEpisodeMap[episode.enclosure.url]) this.selectedEpisodes[String(i)] = false
+ else this.$set(this.selectedEpisodes, String(i), val)
+ }
+ },
+ checkSetIsSelectedAll() {
+ for (let i = 0; i < this.episodes.length; i++) {
+ const episode = this.episodes[i]
+ if (!this.itemEpisodeMap[episode.enclosure.url] && !this.selectedEpisodes[String(i)]) {
+ this.selectAll = false
+ return
+ }
+ }
+ this.selectAll = true
+ },
+ toggleSelectEpisode(index, episode) {
+ if (this.itemEpisodeMap[episode.enclosure.url]) return
this.$set(this.selectedEpisodes, String(index), !this.selectedEpisodes[String(index)])
+ this.checkSetIsSelectedAll()
},
submit() {
var episodesToDownload = []
@@ -145,17 +148,15 @@ export default {
console.error('Failed to download episodes', error)
this.processing = false
this.$toast.error(errorMsg)
+
+ this.selectedEpisodes = {}
+ this.selectAll = false
})
},
init() {
- this.episodes.sort((a, b) => (a.publishedAt < b.publishedAt) ? 1 : -1)
- for (let i = 0; i < this.episodes.length; i++) {
- var episode = this.episodes[i]
- if (episode.enclosure && !this.itemEpisodeMap[episode.enclosure.url]) {
- // Do not include episodes already downloaded
- this.$set(this.selectedEpisodes, String(i), false)
- }
- }
+ this.episodes.sort((a, b) => (a.publishedAt < b.publishedAt ? 1 : -1))
+ this.selectAll = false
+ this.selectedEpisodes = {}
}
},
mounted() {}
@@ -170,4 +171,4 @@ export default {
#episodes-scroll {
max-height: calc(80vh - 200px);
}
-
\ No newline at end of file
+
diff --git a/package-lock.json b/package-lock.json
index 45168dc8..9dcf99df 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -6,7 +6,7 @@
"packages": {
"": {
"name": "audiobookshelf",
- "version": "2.1.2",
+ "version": "2.1.4",
"license": "GPL-3.0",
"dependencies": {
"axios": "^0.26.1",
@@ -1602,4 +1602,4 @@
"integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA=="
}
}
-}
\ No newline at end of file
+}