mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-02-19 00:18:56 +01:00
Add episode filter on the episodes list
This commit is contained in:
parent
6d138ae905
commit
f650ae7f18
@ -19,7 +19,12 @@
|
|||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<p v-if="!episodes.length" class="py-4 text-center text-lg">{{ $strings.MessageNoEpisodes }}</p>
|
<p v-if="!episodes.length" class="py-4 text-center text-lg">{{ $strings.MessageNoEpisodes }}</p>
|
||||||
<template v-for="episode in episodesSorted">
|
<div v-if="episodes.length" class="w-full py-3 mx-auto flex">
|
||||||
|
<form @submit.prevent="submit" class="flex flex-grow">
|
||||||
|
<ui-text-input v-model="search" @input="inputUpdate" placeholder="Search episode..." class="flex-grow mr-2 text-sm md:text-base" />
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<template v-for="episode in episodesList">
|
||||||
<tables-podcast-episode-table-row ref="episodeRow" :key="episode.id" :episode="episode" :library-item-id="libraryItem.id" :selection-mode="isSelectionMode" class="item" @play="playEpisode" @remove="removeEpisode" @edit="editEpisode" @view="viewEpisode" @selected="episodeSelected" @addToQueue="addEpisodeToQueue" @addToPlaylist="addToPlaylist" />
|
<tables-podcast-episode-table-row ref="episodeRow" :key="episode.id" :episode="episode" :library-item-id="libraryItem.id" :selection-mode="isSelectionMode" class="item" @play="playEpisode" @remove="removeEpisode" @edit="editEpisode" @view="viewEpisode" @selected="episodeSelected" @addToQueue="addEpisodeToQueue" @addToPlaylist="addToPlaylist" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -46,7 +51,10 @@ export default {
|
|||||||
selectedEpisodes: [],
|
selectedEpisodes: [],
|
||||||
episodesToRemove: [],
|
episodesToRemove: [],
|
||||||
processing: false,
|
processing: false,
|
||||||
quickMatchingEpisodes: false
|
quickMatchingEpisodes: false,
|
||||||
|
search: null,
|
||||||
|
searchTimeout: null,
|
||||||
|
searchText: null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -137,6 +145,15 @@ export default {
|
|||||||
return String(a[this.sortKey]).localeCompare(String(b[this.sortKey]), undefined, { numeric: true, sensitivity: 'base' })
|
return String(a[this.sortKey]).localeCompare(String(b[this.sortKey]), undefined, { numeric: true, sensitivity: 'base' })
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
episodesList() {
|
||||||
|
return this.episodesSorted.filter((episode) => {
|
||||||
|
if (!this.searchText) return true
|
||||||
|
return (
|
||||||
|
(episode.title && episode.title.toLowerCase().includes(this.searchText)) ||
|
||||||
|
(episode.subtitle && episode.subtitle.toLowerCase().includes(this.searchText))
|
||||||
|
)
|
||||||
|
})
|
||||||
|
},
|
||||||
selectedIsFinished() {
|
selectedIsFinished() {
|
||||||
// Find an item that is not finished, if none then all items finished
|
// Find an item that is not finished, if none then all items finished
|
||||||
return !this.selectedEpisodes.find((episode) => {
|
return !this.selectedEpisodes.find((episode) => {
|
||||||
@ -146,6 +163,16 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
inputUpdate() {
|
||||||
|
clearTimeout(this.searchTimeout)
|
||||||
|
this.searchTimeout = setTimeout(() => {
|
||||||
|
if (!this.search || !this.search.trim()) {
|
||||||
|
this.searchText = ''
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.searchText = this.search.toLowerCase().trim()
|
||||||
|
}, 500)
|
||||||
|
},
|
||||||
contextMenuAction(action) {
|
contextMenuAction(action) {
|
||||||
if (action === 'quick-match-episodes') {
|
if (action === 'quick-match-episodes') {
|
||||||
if (this.quickMatchingEpisodes) return
|
if (this.quickMatchingEpisodes) return
|
||||||
|
Loading…
Reference in New Issue
Block a user