diff --git a/client/components/app/BookShelfToolbar.vue b/client/components/app/BookShelfToolbar.vue
index fe9b3ba1..c5ddf393 100644
--- a/client/components/app/BookShelfToolbar.vue
+++ b/client/components/app/BookShelfToolbar.vue
@@ -72,8 +72,8 @@
-
-
+
+
{{ $strings.ButtonRemoveAll }} {{ numShowing }} {{ entityName }}
@@ -219,30 +219,6 @@ export default {
},
isIssuesFilter() {
return this.filterBy === 'issues' && this.$route.query.filter === 'issues'
- },
- seriesSortBy: {
- get() {
- return this.$store.state.libraries.seriesSortBy
- },
- set(val) {
- this.$store.commit('libraries/setSeriesSortBy', val)
- }
- },
- seriesSortDesc: {
- get() {
- return this.$store.state.libraries.seriesSortDesc
- },
- set(val) {
- this.$store.commit('libraries/setSeriesSortDesc', val)
- }
- },
- seriesFilterBy: {
- get() {
- return this.$store.state.libraries.seriesFilterBy
- },
- set(val) {
- this.$store.commit('libraries/setSeriesFilterBy', val)
- }
}
},
methods: {
@@ -339,10 +315,10 @@ export default {
this.saveSettings()
},
updateSeriesSort() {
- this.$eventBus.$emit('series-sort-updated')
+ this.saveSettings()
},
updateSeriesFilter() {
- this.$eventBus.$emit('series-sort-updated')
+ this.saveSettings()
},
updateCollapseSeries() {
this.saveSettings()
diff --git a/client/components/app/LazyBookshelf.vue b/client/components/app/LazyBookshelf.vue
index 0c40d38e..ca6b50bf 100644
--- a/client/components/app/LazyBookshelf.vue
+++ b/client/components/app/LazyBookshelf.vue
@@ -100,13 +100,13 @@ export default {
return this.page
},
seriesSortBy() {
- return this.$store.state.libraries.seriesSortBy
+ return this.$store.getters['user/getUserSetting']('seriesSortBy')
},
seriesSortDesc() {
- return this.$store.state.libraries.seriesSortDesc
+ return this.$store.getters['user/getUserSetting']('seriesSortDesc')
},
seriesFilterBy() {
- return this.$store.state.libraries.seriesFilterBy
+ return this.$store.getters['user/getUserSetting']('seriesFilterBy')
},
orderBy() {
return this.$store.getters['user/getUserSetting']('orderBy')
@@ -498,7 +498,7 @@ export default {
}
},
settingsUpdated(settings) {
- var wasUpdated = this.checkUpdateSearchParams()
+ const wasUpdated = this.checkUpdateSearchParams()
if (wasUpdated) {
this.resetEntities()
} else if (settings.bookshelfCoverSize !== this.currentBookWidth) {
@@ -667,7 +667,6 @@ export default {
}
})
- this.$eventBus.$on('series-sort-updated', this.seriesSortUpdated)
this.$eventBus.$on('bookshelf_clear_selection', this.clearSelectedEntities)
this.$eventBus.$on('socket_init', this.socketInit)
this.$eventBus.$on('user-settings', this.settingsUpdated)
@@ -695,7 +694,6 @@ export default {
bookshelf.removeEventListener('scroll', this.scroll)
}
- this.$eventBus.$off('series-sort-updated', this.seriesSortUpdated)
this.$eventBus.$off('bookshelf_clear_selection', this.clearSelectedEntities)
this.$eventBus.$off('socket_init', this.socketInit)
this.$eventBus.$off('user-settings', this.settingsUpdated)
diff --git a/client/pages/library/_library/bookshelf/_id.vue b/client/pages/library/_library/bookshelf/_id.vue
index ea1a1ff8..7037a012 100644
--- a/client/pages/library/_library/bookshelf/_id.vue
+++ b/client/pages/library/_library/bookshelf/_id.vue
@@ -15,17 +15,14 @@ export default {
}
// Set series sort by
- if (params.id === 'series') {
- if (query.sort) {
- store.commit('libraries/setSeriesSortBy', query.sort)
- store.commit('libraries/setSeriesSortDesc', !!query.desc)
+ if (query.filter || query.sort || query.desc) {
+ const isSeries = params.id === 'series'
+ const settingsUpdate = {
+ [isSeries ? 'seriesFilterBy' : 'filterBy']: query.filter || undefined,
+ [isSeries ? 'seriesSortBy' : 'orderBy']: query.sort || undefined,
+ [isSeries ? 'seriesSortDesc' : 'orderDesc']: query.desc == '0' ? false : query.desc == '1' ? true : undefined
}
- if (query.filter) {
- console.log('has filter', query.filter)
- store.commit('libraries/setSeriesFilterBy', query.filter)
- }
- } else if (query.filter) {
- store.dispatch('user/updateUserSettings', { filterBy: query.filter })
+ store.dispatch('user/updateUserSettings', settingsUpdate)
}
// Redirect podcast libraries
diff --git a/client/store/libraries.js b/client/store/libraries.js
index 3b06df50..a2e34d78 100644
--- a/client/store/libraries.js
+++ b/client/store/libraries.js
@@ -10,9 +10,6 @@ export const state = () => ({
folderLastUpdate: 0,
filterData: null,
numUserPlaylists: 0,
- seriesSortBy: 'name',
- seriesSortDesc: false,
- seriesFilterBy: 'all',
collections: [],
userPlaylists: []
})
@@ -312,15 +309,6 @@ export const mutations = {
}
}
},
- setSeriesSortBy(state, sortBy) {
- state.seriesSortBy = sortBy
- },
- setSeriesSortDesc(state, sortDesc) {
- state.seriesSortDesc = sortDesc
- },
- setSeriesFilterBy(state, filterBy) {
- state.seriesFilterBy = filterBy
- },
setCollections(state, collections) {
state.collections = collections
},
diff --git a/client/store/user.js b/client/store/user.js
index 33623ba7..95bf2249 100644
--- a/client/store/user.js
+++ b/client/store/user.js
@@ -8,7 +8,10 @@ export const state = () => ({
bookshelfCoverSize: 120,
collapseSeries: false,
collapseBookSeries: false,
- useChapterTrack: false
+ useChapterTrack: false,
+ seriesSortBy: 'name',
+ seriesSortDesc: false,
+ seriesFilterBy: 'all'
}
})
@@ -106,7 +109,6 @@ export const actions = {
}
}
if (hasChanges) {
- localStorage.setItem('userSettings', JSON.stringify(existingSettings))
commit('setSettings', existingSettings)
this.$eventBus.$emit('user-settings', state.settings)
}
@@ -160,6 +162,7 @@ export const mutations = {
},
setSettings(state, settings) {
if (!settings) return
+ localStorage.setItem('userSettings', JSON.stringify(settings))
state.settings = settings
}
}
\ No newline at end of file