mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-30 18:48:55 +01:00
Update:Collapsed series shows series name instead of first book title and only sorts when sorting by title #629
This commit is contained in:
parent
653019921e
commit
51b87912f8
@ -249,6 +249,7 @@ export default {
|
|||||||
},
|
},
|
||||||
displayTitle() {
|
displayTitle() {
|
||||||
if (this.recentEpisode) return this.recentEpisode.title
|
if (this.recentEpisode) return this.recentEpisode.title
|
||||||
|
if (this.collapsedSeries) return this.collapsedSeries.name
|
||||||
if (this.orderBy === 'media.metadata.title' && this.sortingIgnorePrefix) {
|
if (this.orderBy === 'media.metadata.title' && this.sortingIgnorePrefix) {
|
||||||
return this.mediaMetadata.titleIgnorePrefix
|
return this.mediaMetadata.titleIgnorePrefix
|
||||||
}
|
}
|
||||||
@ -257,6 +258,7 @@ export default {
|
|||||||
displayLineTwo() {
|
displayLineTwo() {
|
||||||
if (this.recentEpisode) return this.title
|
if (this.recentEpisode) return this.title
|
||||||
if (this.isPodcast) return this.author
|
if (this.isPodcast) return this.author
|
||||||
|
if (this.collapsedSeries) return ''
|
||||||
if (this.isAuthorBookshelfView) {
|
if (this.isAuthorBookshelfView) {
|
||||||
return this.mediaMetadata.publishedYear || ''
|
return this.mediaMetadata.publishedYear || ''
|
||||||
}
|
}
|
||||||
@ -264,6 +266,7 @@ export default {
|
|||||||
return this.author
|
return this.author
|
||||||
},
|
},
|
||||||
displaySortLine() {
|
displaySortLine() {
|
||||||
|
if (this.collapsedSeries) return null
|
||||||
if (this.orderBy === 'mtimeMs') return 'Modified ' + this.$formatDate(this._libraryItem.mtimeMs, this.dateFormat)
|
if (this.orderBy === 'mtimeMs') return 'Modified ' + this.$formatDate(this._libraryItem.mtimeMs, this.dateFormat)
|
||||||
if (this.orderBy === 'birthtimeMs') return 'Born ' + this.$formatDate(this._libraryItem.birthtimeMs, this.dateFormat)
|
if (this.orderBy === 'birthtimeMs') return 'Born ' + this.$formatDate(this._libraryItem.birthtimeMs, this.dateFormat)
|
||||||
if (this.orderBy === 'addedAt') return 'Added ' + this.$formatDate(this._libraryItem.addedAt, this.dateFormat)
|
if (this.orderBy === 'addedAt') return 'Added ' + this.$formatDate(this._libraryItem.addedAt, this.dateFormat)
|
||||||
|
@ -176,7 +176,8 @@ class LibraryController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle server setting sortingIgnorePrefix
|
// Handle server setting sortingIgnorePrefix
|
||||||
if (sortKey === 'media.metadata.title' && this.db.serverSettings.sortingIgnorePrefix) {
|
const sortByTitle = sortKey === 'media.metadata.title'
|
||||||
|
if (sortByTitle && this.db.serverSettings.sortingIgnorePrefix) {
|
||||||
// BookMetadata.js has titleIgnorePrefix getter
|
// BookMetadata.js has titleIgnorePrefix getter
|
||||||
sortKey += 'IgnorePrefix'
|
sortKey += 'IgnorePrefix'
|
||||||
}
|
}
|
||||||
@ -186,6 +187,16 @@ class LibraryController {
|
|||||||
var sortArray = [
|
var sortArray = [
|
||||||
{
|
{
|
||||||
[direction]: (li) => {
|
[direction]: (li) => {
|
||||||
|
// When collapsing by series and sorting by title use the series name instead of the book title
|
||||||
|
if (payload.mediaType === 'book' && payload.collapseseries && li.media.metadata.seriesName) {
|
||||||
|
if (sortByTitle) {
|
||||||
|
return li.media.metadata.seriesName
|
||||||
|
} else {
|
||||||
|
// When not sorting by title always show the collapsed series at the end
|
||||||
|
return direction === 'desc' ? -1 : 'zzzz'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Supports dot notation strings i.e. "media.metadata.title"
|
// Supports dot notation strings i.e. "media.metadata.title"
|
||||||
return sortKey.split('.').reduce((a, b) => a[b], li)
|
return sortKey.split('.').reduce((a, b) => a[b], li)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user