From b64a651b27a3c6bbd2f264d70a13cacbb29914e5 Mon Sep 17 00:00:00 2001 From: advplyr Date: Sat, 30 Jul 2022 17:07:54 -0500 Subject: [PATCH] Update:Series page support sort ignore prefix #866 --- client/components/cards/LazySeriesCard.vue | 18 +++++++++++++----- client/mixins/bookshelfCardsHelpers.js | 4 ++-- server/controllers/LibraryController.js | 2 +- server/utils/libraryHelpers.js | 3 ++- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/client/components/cards/LazySeriesCard.vue b/client/components/cards/LazySeriesCard.vue index 9a7929d2..509e6b7f 100644 --- a/client/components/cards/LazySeriesCard.vue +++ b/client/components/cards/LazySeriesCard.vue @@ -2,7 +2,7 @@
- +
{{ books.length }}
@@ -10,16 +10,16 @@
-

{{ title }}

+

{{ displayTitle }}

-

{{ title }}

+

{{ displayTitle }}

-

{{ title }}

+

{{ displayTitle }}

@@ -39,7 +39,8 @@ export default { seriesMount: { type: Object, default: () => null - } + }, + sortingIgnorePrefix: Boolean }, data() { return { @@ -65,6 +66,13 @@ export default { title() { return this.series ? this.series.name : '' }, + nameIgnorePrefix() { + return this.series ? this.series.nameIgnorePrefix : '' + }, + displayTitle() { + if (this.sortingIgnorePrefix) return this.nameIgnorePrefix || this.title + return this.title + }, books() { return this.series ? this.series.books || [] : [] }, diff --git a/client/mixins/bookshelfCardsHelpers.js b/client/mixins/bookshelfCardsHelpers.js index 08bd1e9b..84bdc9d7 100644 --- a/client/mixins/bookshelfCardsHelpers.js +++ b/client/mixins/bookshelfCardsHelpers.js @@ -52,13 +52,13 @@ export default { width: this.entityWidth, height: this.entityHeight, bookCoverAspectRatio: this.bookCoverAspectRatio, - bookshelfView: this.bookshelfView + bookshelfView: this.bookshelfView, + sortingIgnorePrefix: !!this.sortingIgnorePrefix } if (this.entityName === 'books') { props.filterBy = this.filterBy props.orderBy = this.orderBy - props.sortingIgnorePrefix = !!this.sortingIgnorePrefix } var _this = this diff --git a/server/controllers/LibraryController.js b/server/controllers/LibraryController.js index 32caba34..58182625 100644 --- a/server/controllers/LibraryController.js +++ b/server/controllers/LibraryController.js @@ -273,7 +273,7 @@ class LibraryController { var series = libraryHelpers.getSeriesFromBooks(libraryItems, payload.minified) series = sort(series).asc(s => { - return s.name + return this.db.serverSettings.sortingIgnorePrefix ? s.nameIgnorePrefix : s.name }) payload.total = series.length diff --git a/server/utils/libraryHelpers.js b/server/utils/libraryHelpers.js index df6e68bb..efac202d 100644 --- a/server/utils/libraryHelpers.js +++ b/server/utils/libraryHelpers.js @@ -124,6 +124,7 @@ module.exports = { _series[series.id] = { id: series.id, name: series.name, + nameIgnorePrefix: getTitleIgnorePrefix(series.name), type: 'series', books: [abJson] } @@ -229,7 +230,7 @@ module.exports = { libraryItemJson.collapsedSeries = { id: seriesToUse[li.id].id, name: seriesToUse[li.id].name, - nameIgnorePrefix: getTitleIgnorePrefix(seriesToUse[li.id].name), + nameIgnorePrefix: seriesToUse[li.id].nameIgnorePrefix, numBooks: seriesToUse[li.id].books.length } }