owntone-server/web-src/src/components/ListPlaylists.vue

64 lines
1.7 KiB
Vue
Raw Normal View History

<template>
2022-05-20 07:44:22 -04:00
<div v-for="playlist in playlists" :key="playlist.itemId" class="media" :playlist="playlist" @click="open_playlist(playlist.item)">
<figure class="media-left fd-has-action">
2022-05-20 07:44:22 -04:00
<mdicon class="icon" :name="icon_name(playlist.item)" size="16" />
</figure>
<div class="media-content fd-has-action is-clipped">
2022-05-20 07:44:22 -04:00
<h1 class="title is-6" v-text="playlist.item.name" />
</div>
<div class="media-right">
<a @click.prevent.stop="open_dialog(playlist.item)">
2022-05-20 07:44:22 -04:00
<mdicon class="icon has-text-dark" name="dots-vertical" size="16" />
</a>
</div>
</div>
<teleport to="#app">
2022-05-20 07:44:22 -04:00
<modal-dialog-playlist :show="show_details_modal" :playlist="selected_playlist" @close="show_details_modal = false" />
</teleport>
</template>
<script>
2022-02-19 00:18:01 -05:00
import ModalDialogPlaylist from '@/components/ModalDialogPlaylist.vue'
export default {
name: 'ListPlaylists',
components: { ModalDialogPlaylist },
props: ['playlists'],
data() {
return {
show_details_modal: false,
selected_playlist: {}
}
},
methods: {
open_playlist: function (playlist) {
if (playlist.type !== 'folder') {
this.$router.push({ path: '/playlists/' + playlist.id + '/tracks' })
} else {
this.$router.push({ path: '/playlists/' + playlist.id })
}
},
open_dialog: function (playlist) {
this.selected_playlist = playlist
this.show_details_modal = true
},
icon_name: function (playlist) {
if (playlist.type === 'folder') {
return 'folder'
} else if (playlist.type === 'rss') {
return 'rss'
} else {
return 'music-box-multiple'
}
}
}
}
</script>
<style></style>