2018-08-11 01:47:10 -04:00
|
|
|
<template>
|
|
|
|
<content-with-heading>
|
|
|
|
<template slot="heading-left">
|
|
|
|
<div class="title is-4">{{ playlist.name }}</div>
|
|
|
|
</template>
|
|
|
|
<template slot="heading-right">
|
|
|
|
<a class="button is-small is-dark is-rounded" @click="play">
|
2018-11-06 15:44:01 -05:00
|
|
|
<span class="icon"><i class="mdi mdi-shuffle"></i></span> <span>Shuffle</span>
|
2018-08-11 01:47:10 -04:00
|
|
|
</a>
|
|
|
|
</template>
|
|
|
|
<template slot="content">
|
|
|
|
<p class="heading has-text-centered-mobile">{{ tracks.length }} tracks</p>
|
2018-12-15 03:56:09 -05:00
|
|
|
<list-item-track v-for="(track, index) in tracks" :key="track.id" :track="track" :position="index" :context_uri="playlist.uri">
|
|
|
|
<template slot="actions">
|
|
|
|
<a @click="open_dialog(track)">
|
|
|
|
<span class="icon has-text-dark"><i class="mdi mdi-dots-vertical mdi-18px"></i></span>
|
|
|
|
</a>
|
|
|
|
</template>
|
|
|
|
</list-item-track>
|
|
|
|
<modal-dialog-track :show="show_details_modal" :track="selected_track" @close="show_details_modal = false" />
|
2018-08-11 01:47:10 -04:00
|
|
|
</template>
|
|
|
|
</content-with-heading>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { LoadDataBeforeEnterMixin } from './mixin'
|
|
|
|
import ContentWithHeading from '@/templates/ContentWithHeading'
|
|
|
|
import ListItemTrack from '@/components/ListItemTrack'
|
2018-12-15 03:56:09 -05:00
|
|
|
import ModalDialogTrack from '@/components/ModalDialogTrack'
|
2018-08-11 01:47:10 -04:00
|
|
|
import webapi from '@/webapi'
|
|
|
|
|
|
|
|
const playlistData = {
|
|
|
|
load: function (to) {
|
|
|
|
return Promise.all([
|
|
|
|
webapi.library_playlist(to.params.playlist_id),
|
|
|
|
webapi.library_playlist_tracks(to.params.playlist_id)
|
|
|
|
])
|
|
|
|
},
|
|
|
|
|
|
|
|
set: function (vm, response) {
|
|
|
|
vm.playlist = response[0].data
|
|
|
|
vm.tracks = response[1].data.items
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'PagePlaylist',
|
|
|
|
mixins: [ LoadDataBeforeEnterMixin(playlistData) ],
|
2018-12-15 03:56:09 -05:00
|
|
|
components: { ContentWithHeading, ListItemTrack, ModalDialogTrack },
|
2018-08-11 01:47:10 -04:00
|
|
|
|
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
playlist: {},
|
2018-12-15 03:56:09 -05:00
|
|
|
tracks: [],
|
|
|
|
|
|
|
|
show_details_modal: false,
|
|
|
|
selected_track: {}
|
2018-08-11 01:47:10 -04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
play: function () {
|
2018-11-06 15:44:01 -05:00
|
|
|
webapi.player_play_uri(this.playlist.uri, true)
|
2018-12-15 03:56:09 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
open_dialog: function (track) {
|
|
|
|
this.selected_track = track
|
|
|
|
this.show_details_modal = true
|
2018-08-11 01:47:10 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
</style>
|