Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Feat/book series info #3839

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion client/components/app/BookShelfToolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
</ui-tooltip>

<ui-context-menu-dropdown v-if="!isBatchSelecting && seriesContextMenuItems.length" :items="seriesContextMenuItems" class="mx-px" @action="seriesContextMenuAction" />

<modals-edit-series-modal v-model="showEditSeriesModal" :series="this.selectedSeries" />
</template>
<!-- library & collections page -->
<template v-else-if="page !== 'search' && page !== 'podcast-search' && page !== 'recent-episodes' && !isHome && !isAuthorsPage">
Expand Down Expand Up @@ -131,14 +133,19 @@ export default {
totalEntities: 0,
processingSeries: false,
processingIssues: false,
processingAuthors: false
processingAuthors: false,
showEditSeriesModal: false
}
},
computed: {
seriesContextMenuItems() {
if (!this.selectedSeries) return []

const items = [
{
text: this.$strings.LabelEditSeries,
action: 'edit-series'
},
{
text: this.isSeriesFinished ? this.$strings.MessageMarkAsNotFinished : this.$strings.MessageMarkAsFinished,
action: 'mark-series-finished'
Expand Down Expand Up @@ -440,6 +447,9 @@ export default {
exportOPML() {
this.$downloadFile(`/api/libraries/${this.currentLibraryId}/opml?token=${this.$store.getters['user/getToken']}`, null, true)
},
showEditSeries() {
this.showEditSeriesModal = !this.showEditSeriesModal
},
seriesContextMenuAction({ action }) {
if (action === 'open-rss-feed') {
this.showOpenSeriesRSSFeed()
Expand All @@ -455,6 +465,8 @@ export default {
return
}
this.markSeriesFinished()
} else if ((action = 'edit-series')) {
this.showEditSeries()
} else if (this.handleSubtitlesAction(action)) {
return
} else if (this.handleCollapseSubSeriesAction(action)) {
Expand Down
65 changes: 65 additions & 0 deletions client/components/modals/EditSeriesModal.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<template>
<modals-modal v-model="show" name="edit-series" :processing="isProcessing" :width="500" :height="'unset'">
<div ref="container" class="w-full rounded-lg bg-bg box-shadow-md overflow-y-auto overflow-x-hidden p-4" style="max-height: 80vh; min-height: 40vh">
<h3 class="text-xl font-semibold mb-8">{{ $strings.LabelEditSeries }}</h3>
<div class="flex items-center mb-4">
<ui-textarea-with-label v-model="descriptionValue" :label="$strings.LabelSeriesDescription" :rows="8" />
</div>
<div class="absolute bottom-0 left-0 w-full py-2 md:py-4 bg-bg border-t border-white border-opacity-5">
<div class="flex items-center px-4">
<div class="flex-grow" />

<!-- desktop -->
<ui-btn @click="save" class="mx-2 hidden md:block">{{ $strings.ButtonSave }}</ui-btn>
<ui-btn @click="saveAndClose" class="mx-2 hidden md:block">{{ $strings.ButtonSaveAndClose }}</ui-btn>
<!-- mobile -->
<ui-btn @click="saveAndClose" class="mx-2 md:hidden">{{ $strings.ButtonSave }}</ui-btn>
</div>
</div>
</div>
</modals-modal>
</template>

<script>
export default {
props: {
value: Boolean,
series: Object
},
data() {
return {
isProcessing: false,
descriptionValue: ''
}
},
computed: {
show: {
get() {
return this.value
},
set(val) {
this.$emit('input', val)
}
}
},
methods: {
async save() {
if (this.isProcessing) {
return null
}

const payload = {
description: this.descriptionValue
}

this.isProcessing = true
// Handle series update
this.isProcessing = false
},
async saveAndClose() {
const wasUpdated = await this.save()
if (wasUpdated !== null) this.show = false
}
}
}
</script>
2 changes: 2 additions & 0 deletions client/strings/en-us.json
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@
"LabelEbook": "Ebook",
"LabelEbooks": "Ebooks",
"LabelEdit": "Edit",
"LabelEditSeries": "Edit Series",
"LabelEmail": "Email",
"LabelEmailSettingsFromAddress": "From Address",
"LabelEmailSettingsRejectUnauthorized": "Reject unauthorized certificates",
Expand Down Expand Up @@ -543,6 +544,7 @@
"LabelSequence": "Sequence",
"LabelSerial": "Serial",
"LabelSeries": "Series",
"LabelSeriesDescription": "Series Description",
"LabelSeriesName": "Series Name",
"LabelSeriesProgress": "Series Progress",
"LabelServerLogLevel": "Server Log Level",
Expand Down
Loading