Skip to content
Snippets Groups Projects
Verified Commit 1822fdf4 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Fix #116: On artist page, albums are not sorted by release date, if any

parent 7e593ad0
No related branches found
No related tags found
No related merge requests found
On artist page, albums are not sorted by release date, if any (#116)
......@@ -6,12 +6,13 @@
<img v-else src="../../../assets/audio/default-cover.png">
</div>
<div class="header">
<router-link class="discrete link" :to="{name: 'library.albums.detail', params: {id: album.id }}">{{ album.title }}</router-link>
<router-link class="discrete link" :to="{name: 'library.albums.detail', params: {id: album.id }}">{{ album.title }} </router-link>
</div>
<div class="meta">
By <router-link :to="{name: 'library.artists.detail', params: {id: album.artist.id }}">
{{ album.artist.name }}
</router-link>
<span>
By <router-link tag="span" :to="{name: 'library.artists.detail', params: {id: album.artist.id }}">
{{ album.artist.name }}</router-link>
</span><span class="time" v-if="album.release_date">{{ album.release_date | year }}</span>
</div>
<div class="description" v-if="mode === 'rich'">
<table class="ui very basic fixed single line compact unstackable table">
......
......@@ -31,7 +31,7 @@
<div class="ui vertical stripe segment">
<h2>Albums by this artist</h2>
<div class="ui stackable doubling three column grid">
<div class="column" :key="album.id" v-for="album in albums">
<div class="column" :key="album.id" v-for="album in sortedAlbums">
<album-card :mode="'rich'" class="fluid" :album="album"></album-card>
</div>
</div>
......@@ -41,6 +41,7 @@
</template>
<script>
import _ from 'lodash'
import axios from 'axios'
import logger from '@/logging'
import backend from '@/audio/backend'
......@@ -83,6 +84,10 @@ export default {
}
},
computed: {
sortedAlbums () {
let a = this.albums || []
return _.orderBy(a, ['release_date'], ['asc'])
},
totalTracks () {
return this.albums.map((album) => {
return album.tracks.length
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment