[web-src] Add index navigation to artist tracks page

This commit is contained in:
chme 2018-12-19 17:50:02 +01:00
parent 8b37039b15
commit 11179f7ac5
2 changed files with 14 additions and 3 deletions

View File

@ -1,6 +1,9 @@
<template> <template>
<div> <div>
<content-with-heading> <content-with-heading>
<template slot="options">
<index-button-list :index="index_list"></index-button-list>
</template>
<template slot="heading-left"> <template slot="heading-left">
<p class="title is-4">{{ artist.name }}</p> <p class="title is-4">{{ artist.name }}</p>
</template> </template>
@ -27,6 +30,7 @@
<script> <script>
import { LoadDataBeforeEnterMixin } from './mixin' import { LoadDataBeforeEnterMixin } from './mixin'
import ContentWithHeading from '@/templates/ContentWithHeading' import ContentWithHeading from '@/templates/ContentWithHeading'
import IndexButtonList from '@/components/IndexButtonList'
import ListItemTrack from '@/components/ListItemTrack' import ListItemTrack from '@/components/ListItemTrack'
import ModalDialogTrack from '@/components/ModalDialogTrack' import ModalDialogTrack from '@/components/ModalDialogTrack'
import webapi from '@/webapi' import webapi from '@/webapi'
@ -48,18 +52,25 @@ const tracksData = {
export default { export default {
name: 'PageArtistTracks', name: 'PageArtistTracks',
mixins: [ LoadDataBeforeEnterMixin(tracksData) ], mixins: [ LoadDataBeforeEnterMixin(tracksData) ],
components: { ContentWithHeading, ListItemTrack, ModalDialogTrack }, components: { ContentWithHeading, ListItemTrack, IndexButtonList, ModalDialogTrack },
data () { data () {
return { return {
artist: {}, artist: {},
tracks: {}, tracks: { items: [] },
show_details_modal: false, show_details_modal: false,
selected_track: {} selected_track: {}
} }
}, },
computed: {
index_list () {
return [...new Set(this.tracks.items
.map(track => track.title.charAt(0).toUpperCase()))]
}
},
methods: { methods: {
open_artist: function () { open_artist: function () {
this.show_details_modal = false this.show_details_modal = false

View File

@ -88,7 +88,7 @@ export const router = new VueRouter({
path: '/music/artists/:artist_id/tracks', path: '/music/artists/:artist_id/tracks',
name: 'Tracks', name: 'Tracks',
component: PageArtistTracks, component: PageArtistTracks,
meta: { show_progress: true } meta: { show_progress: true, has_index: true }
}, },
{ {
path: '/music/albums', path: '/music/albums',