mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-20 19:06:06 +01:00
Update:Series page toolbar add context menu and confirm dialog for marking series as finished
This commit is contained in:
parent
d8ee61bfab
commit
6bfa281dc5
@ -50,18 +50,8 @@
|
||||
</div>
|
||||
<div class="flex-grow" />
|
||||
<ui-checkbox v-if="!isBatchSelecting" v-model="settings.collapseBookSeries" :label="$strings.LabelCollapseSeries" checkbox-bg="bg" check-color="white" small class="mr-2" @input="updateCollapseBookSeries" />
|
||||
<ui-btn v-if="!isBatchSelecting" color="primary" small :loading="processingSeries" class="items-center ml-1 sm:ml-4 hidden md:flex" @click="markSeriesFinished">
|
||||
<div class="h-5 w-5">
|
||||
<svg v-if="isSeriesFinished" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="rgb(63, 181, 68)">
|
||||
<path d="M19 1H5c-1.1 0-1.99.9-1.99 2L3 15.93c0 .69.35 1.3.88 1.66L12 23l8.11-5.41c.53-.36.88-.97.88-1.66L21 3c0-1.1-.9-2-2-2zm-9 15l-5-5 1.41-1.41L10 13.17l7.59-7.59L19 7l-9 9z" />
|
||||
</svg>
|
||||
<svg v-else xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
||||
<path d="M19 1H5c-1.1 0-1.99.9-1.99 2L3 15.93c0 .69.35 1.3.88 1.66L12 23l8.11-5.41c.53-.36.88-.97.88-1.66L21 3c0-1.1-.9-2-2-2zm-7 19.6l-7-4.66V3h14v12.93l-7 4.67zm-2.01-7.42l-2.58-2.59L6 12l4 4 8-8-1.42-1.42z" />
|
||||
</svg>
|
||||
</div>
|
||||
<span class="pl-2"> {{ $strings.LabelMarkSeries }} {{ isSeriesFinished ? $strings.LabelNotFinished : $strings.LabelFinished }}</span>
|
||||
</ui-btn>
|
||||
<ui-btn v-if="isSeriesRemovedFromContinueListening && !isBatchSelecting" small :loading="processingSeries" @click="reAddSeriesToContinueListening" class="hidden md:block ml-2"> Re-Add Series to Continue Listening </ui-btn>
|
||||
|
||||
<ui-context-menu-dropdown v-if="!isBatchSelecting && seriesContextMenuItems.length" :items="seriesContextMenuItems" class="mx-px" @action="seriesContextMenuAction" />
|
||||
</template>
|
||||
<!-- library & collections page -->
|
||||
<template v-else-if="page !== 'search' && page !== 'podcast-search' && page !== 'recent-episodes' && !isHome">
|
||||
@ -114,10 +104,42 @@ export default {
|
||||
totalEntities: 0,
|
||||
processingSeries: false,
|
||||
processingIssues: false,
|
||||
processingAuthors: false
|
||||
processingAuthors: false,
|
||||
contextMenuItems: [
|
||||
{
|
||||
text: 'cat',
|
||||
action: 'dog'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
seriesContextMenuItems() {
|
||||
if (!this.selectedSeries) return []
|
||||
|
||||
const items = [
|
||||
{
|
||||
text: this.isSeriesFinished ? 'Mark series as not finished' : 'Mark series as finished',
|
||||
action: 'mark-series-finished'
|
||||
}
|
||||
]
|
||||
|
||||
if (this.userIsAdminOrUp || this.selectedSeries.rssFeed) {
|
||||
items.push({
|
||||
text: this.$strings.LabelOpenRSSFeed,
|
||||
action: 'open-rss-feed'
|
||||
})
|
||||
}
|
||||
|
||||
if (this.isSeriesRemovedFromContinueListening) {
|
||||
items.push({
|
||||
text: 'Re-Add Series to Continue Listening',
|
||||
action: 're-add-to-continue-listening'
|
||||
})
|
||||
}
|
||||
|
||||
return items
|
||||
},
|
||||
seriesSortItems() {
|
||||
return [
|
||||
{
|
||||
@ -229,6 +251,23 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
seriesContextMenuAction(action) {
|
||||
if (action === 'open-rss-feed') {
|
||||
// TODO: Open RSS Feed
|
||||
} else if (action === 're-add-to-continue-listening') {
|
||||
if (this.processingSeries) {
|
||||
console.warn('Already processing series')
|
||||
return
|
||||
}
|
||||
this.reAddSeriesToContinueListening()
|
||||
} else if (action === 'mark-series-finished') {
|
||||
if (this.processingSeries) {
|
||||
console.warn('Already processing series')
|
||||
return
|
||||
}
|
||||
this.markSeriesFinished()
|
||||
}
|
||||
},
|
||||
reAddSeriesToContinueListening() {
|
||||
this.processingSeries = true
|
||||
this.$axios
|
||||
@ -293,9 +332,16 @@ export default {
|
||||
}
|
||||
},
|
||||
markSeriesFinished() {
|
||||
var newIsFinished = !this.isSeriesFinished
|
||||
const newIsFinished = !this.isSeriesFinished
|
||||
|
||||
const message = newIsFinished ? 'Are you sure you want to mark all books in this series as finished?' : 'Are you sure you want to reset your progress on all books in this series?'
|
||||
|
||||
const payload = {
|
||||
message,
|
||||
callback: (confirmed) => {
|
||||
if (confirmed) {
|
||||
this.processingSeries = true
|
||||
var updateProgressPayloads = this.seriesLibraryItemIds.map((lid) => {
|
||||
const updateProgressPayloads = this.seriesLibraryItemIds.map((lid) => {
|
||||
return {
|
||||
libraryItemId: lid,
|
||||
isFinished: newIsFinished
|
||||
@ -314,6 +360,11 @@ export default {
|
||||
console.error('Failed to batch update read/not read', error)
|
||||
this.processingSeries = false
|
||||
})
|
||||
}
|
||||
},
|
||||
type: 'yesNo'
|
||||
}
|
||||
this.$store.commit('globals/setConfirmPrompt', payload)
|
||||
},
|
||||
updateOrder() {
|
||||
this.saveSettings()
|
||||
|
Loading…
Reference in New Issue
Block a user