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 @@ ...@@ -6,12 +6,13 @@
<img v-else src="../../../assets/audio/default-cover.png"> <img v-else src="../../../assets/audio/default-cover.png">
</div> </div>
<div class="header"> <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>
<div class="meta"> <div class="meta">
By <router-link :to="{name: 'library.artists.detail', params: {id: album.artist.id }}"> <span>
{{ album.artist.name }} By <router-link tag="span" :to="{name: 'library.artists.detail', params: {id: album.artist.id }}">
</router-link> {{ album.artist.name }}</router-link>
</span><span class="time" v-if="album.release_date">{{ album.release_date | year }}</span>
</div> </div>
<div class="description" v-if="mode === 'rich'"> <div class="description" v-if="mode === 'rich'">
<table class="ui very basic fixed single line compact unstackable table"> <table class="ui very basic fixed single line compact unstackable table">
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<div class="ui vertical stripe segment"> <div class="ui vertical stripe segment">
<h2>Albums by this artist</h2> <h2>Albums by this artist</h2>
<div class="ui stackable doubling three column grid"> <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> <album-card :mode="'rich'" class="fluid" :album="album"></album-card>
</div> </div>
</div> </div>
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
</template> </template>
<script> <script>
import _ from 'lodash'
import axios from 'axios' import axios from 'axios'
import logger from '@/logging' import logger from '@/logging'
import backend from '@/audio/backend' import backend from '@/audio/backend'
...@@ -83,6 +84,10 @@ export default { ...@@ -83,6 +84,10 @@ export default {
} }
}, },
computed: { computed: {
sortedAlbums () {
let a = this.albums || []
return _.orderBy(a, ['release_date'], ['asc'])
},
totalTracks () { totalTracks () {
return this.albums.map((album) => { return this.albums.map((album) => {
return album.tracks.length 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