From e2bb0cfb7cb7fb4587eaf0ff346296c37c24b315 Mon Sep 17 00:00:00 2001 From: KeyboardHammer Date: Sat, 3 Feb 2024 21:48:35 -0600 Subject: [PATCH 1/6] add sorting to author page --- client/components/app/BookShelfToolbar.vue | 30 +++++++++++++++++++ .../pages/library/_library/authors/index.vue | 23 +++++++++++++- client/store/user.js | 4 ++- server/controllers/LibraryController.js | 1 + 4 files changed, 56 insertions(+), 2 deletions(-) diff --git a/client/components/app/BookShelfToolbar.vue b/client/components/app/BookShelfToolbar.vue index bd31768b..74ab02f1 100644 --- a/client/components/app/BookShelfToolbar.vue +++ b/client/components/app/BookShelfToolbar.vue @@ -98,6 +98,9 @@ @@ -183,6 +186,30 @@ export default { } ] }, + authorSortItems() { + return [ + { + text: this.$strings.LabelAuthorFirstLast, + value: 'name' + }, + { + text: this.$strings.LabelAuthorLastFirst, + value: 'lastFirst' + }, + { + text: this.$strings.LabelNumberOfBooks, + value: 'numBooks' + }, + { + text: this.$strings.LabelAddedAt, + value: 'addedAt' + }, + { + text: this.$strings.LabelLastUpdated, + value: 'lastUpdated' + } + ] + }, userIsAdminOrUp() { return this.$store.getters['user/getIsAdminOrUp'] }, @@ -455,6 +482,9 @@ export default { updateCollapseBookSeries() { this.saveSettings() }, + updateAuthorSort() { + this.saveSettings() + }, saveSettings() { this.$store.dispatch('user/updateUserSettings', this.settings) }, diff --git a/client/pages/library/_library/authors/index.vue b/client/pages/library/_library/authors/index.vue index 1f8e385b..a81865a5 100644 --- a/client/pages/library/_library/authors/index.vue +++ b/client/pages/library/_library/authors/index.vue @@ -48,9 +48,12 @@ export default { }, methods: { async init() { + this.settings = { ...this.$store.state.user.settings } this.authors = await this.$axios .$get(`/api/libraries/${this.currentLibraryId}/authors`) - .then((response) => response.authors) + .then((response) => { + return this.sortAuthors(response.authors) + }) .catch((error) => { console.error('Failed to load authors', error) return [] @@ -78,15 +81,33 @@ export default { }, editAuthor(author) { this.$store.commit('globals/showEditAuthorModal', author) + }, + sortAuthors(authors) { + const sortProp = this.settings.authorSortBy + const bDesc = this.settings.authorSortDesc === true ? -1 : 1 + return authors.sort((a, b) => { + if (typeof a[sortProp] === 'number' && typeof b[sortProp] === 'number') { + return a[sortProp] > b[sortProp] ? 1 * bDesc : -1 * bDesc + } + return a[sortProp].localeCompare(b[sortProp], undefined, { sensitivity: 'base' }) * bDesc + }) + }, + settingsUpdated(settings) { + for (const key in settings) { + this.settings[key] = settings[key] + } + this.sortAuthors(this.authors) } }, mounted() { this.init() + this.$eventBus.$on('user-settings', this.settingsUpdated) this.$root.socket.on('author_added', this.authorAdded) this.$root.socket.on('author_updated', this.authorUpdated) this.$root.socket.on('author_removed', this.authorRemoved) }, beforeDestroy() { + this.$eventBus.$off('user-settings', this.settingsUpdated) this.$root.socket.off('author_added', this.authorAdded) this.$root.socket.off('author_updated', this.authorUpdated) this.$root.socket.off('author_removed', this.authorRemoved) diff --git a/client/store/user.js b/client/store/user.js index 85babb09..40a8813f 100644 --- a/client/store/user.js +++ b/client/store/user.js @@ -11,7 +11,9 @@ export const state = () => ({ useChapterTrack: false, seriesSortBy: 'name', seriesSortDesc: false, - seriesFilterBy: 'all' + seriesFilterBy: 'all', + authorSortBy: 'name', + authorSortDesc: false, } }) diff --git a/server/controllers/LibraryController.js b/server/controllers/LibraryController.js index 70baff85..b2500d4f 100644 --- a/server/controllers/LibraryController.js +++ b/server/controllers/LibraryController.js @@ -636,6 +636,7 @@ class LibraryController { for (const author of authors) { const oldAuthor = author.getOldAuthor().toJSON() oldAuthor.numBooks = author.books.length + oldAuthor.lastFirst = author.lastFirst oldAuthors.push(oldAuthor) } From d24427aad8dd613d2035e0424930f705527b185a Mon Sep 17 00:00:00 2001 From: KeyboardHammer Date: Sat, 3 Feb 2024 22:04:40 -0600 Subject: [PATCH 2/6] fix property --- client/components/app/BookShelfToolbar.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/components/app/BookShelfToolbar.vue b/client/components/app/BookShelfToolbar.vue index 74ab02f1..9064c914 100644 --- a/client/components/app/BookShelfToolbar.vue +++ b/client/components/app/BookShelfToolbar.vue @@ -205,8 +205,8 @@ export default { value: 'addedAt' }, { - text: this.$strings.LabelLastUpdated, - value: 'lastUpdated' + text: this.$strings.LabelUpdatedAt, + value: 'updatedAt' } ] }, From b52341dbcfdbc480120fd4c73d39dab14d4aec46 Mon Sep 17 00:00:00 2001 From: pmangro <160148596+pmangro@users.noreply.github.com> Date: Sun, 3 Mar 2024 13:32:01 -0300 Subject: [PATCH 3/6] [PT-BR] enhance-ebook-filter strings translation --- client/strings/pt-br.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/strings/pt-br.json b/client/strings/pt-br.json index 2630bc09..0f0b0f06 100644 --- a/client/strings/pt-br.json +++ b/client/strings/pt-br.json @@ -356,9 +356,9 @@ "LabelMetaTags": "Etiquetas Meta", "LabelMinute": "Minuto", "LabelMissing": "Ausente", - "LabelMissingEbook": "Has no ebook", + "LabelMissingEbook": "Ebook não existe", "LabelMissingParts": "Partes Ausentes", - "LabelMissingSupplementaryEbook": "Has no supplementary ebook", + "LabelMissingSupplementaryEbook": "Ebook complementar não existe", "LabelMobileRedirectURIs": "URIs de redirecionamento móveis permitidas", "LabelMobileRedirectURIsDescription": "Essa é uma lista de permissionamento para URIs válidas para o redirecionamento de aplicativos móveis. A padrão é audiobookshelf://oauth, que pode ser removida ou acrescentada com novas URIs para integração com apps de terceiros. Usando um asterisco (*) como um item único dará permissão para qualquer URI.", "LabelMore": "Mais", From 8a0fab2b2080e44a97354832a6446394257d47af Mon Sep 17 00:00:00 2001 From: advplyr Date: Tue, 5 Mar 2024 14:30:39 -0600 Subject: [PATCH 4/6] Fix:Resizing page update chapter ticks and track bar #2707 --- client/components/player/PlayerTrackBar.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/components/player/PlayerTrackBar.vue b/client/components/player/PlayerTrackBar.vue index 2f832785..3afc5d06 100644 --- a/client/components/player/PlayerTrackBar.vue +++ b/client/components/player/PlayerTrackBar.vue @@ -57,7 +57,6 @@ export default { }, watch: { duration: { - immediate: true, handler() { this.setChapterTicks() } @@ -205,10 +204,14 @@ export default { }, windowResize() { this.setTrackWidth() + this.setChapterTicks() + this.updatePlayedTrackWidth() + this.updateBufferTrack() } }, mounted() { this.setTrackWidth() + this.setChapterTicks() window.addEventListener('resize', this.windowResize) }, beforeDestroy() { From 4dd140585d95bc30f14448072f7c0766d07b2388 Mon Sep 17 00:00:00 2001 From: advplyr Date: Wed, 6 Mar 2024 15:29:10 -0600 Subject: [PATCH 5/6] Add:Abridged checkbox to batch edit overwrite map details #2695 --- client/pages/batch/index.vue | 58 +++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/client/pages/batch/index.vue b/client/pages/batch/index.vue index 15675fb8..e1687f0f 100644 --- a/client/pages/batch/index.vue +++ b/client/pages/batch/index.vue @@ -20,44 +20,44 @@
-
+
- +
-
+
- +
-
+
- +
-
+
- +
-
+
- +
-
+
- +
-
+
- +
-
+
- +
-
+
- +
-
+
+
+ +
+ +
+
{{ $strings.ButtonApply }} @@ -139,7 +153,8 @@ export default { narrators: [], publisher: null, language: null, - explicit: false + explicit: false, + abridged: false }, selectedBatchUsage: { subtitle: false, @@ -151,7 +166,8 @@ export default { narrators: false, publisher: false, language: false, - explicit: false + explicit: false, + abridged: false }, appendableKeys: ['authors', 'genres', 'tags', 'narrators', 'series'], openMapOptions: false From 305689d5130eb8c481005ef5e9c08e7612af14de Mon Sep 17 00:00:00 2001 From: advplyr Date: Thu, 7 Mar 2024 12:26:04 -0600 Subject: [PATCH 6/6] Update authors sort --- .../pages/library/_library/authors/index.vue | 41 ++++++++----------- client/store/user.js | 2 +- 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/client/pages/library/_library/authors/index.vue b/client/pages/library/_library/authors/index.vue index a81865a5..3906f671 100644 --- a/client/pages/library/_library/authors/index.vue +++ b/client/pages/library/_library/authors/index.vue @@ -3,7 +3,7 @@
-