mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-09 05:53:23 -05:00
80 lines
2.1 KiB
Vue
80 lines
2.1 KiB
Vue
<template>
|
|
<div>
|
|
<content-with-heading>
|
|
<template slot="heading-left">
|
|
<p class="title is-4">{{ name }}</p>
|
|
</template>
|
|
<template slot="heading-right">
|
|
<a class="button is-small is-dark is-rounded" @click="play">
|
|
<span class="icon"><i class="mdi mdi-shuffle"></i></span> <span>Shuffle</span>
|
|
</a>
|
|
</template>
|
|
<template slot="content">
|
|
<p class="heading has-text-centered-mobile">{{ genreAlbums.total }} albums | <a class="has-text-link" @click="open_tracks">{{ tracks }} tracks</a></p>
|
|
<list-item-albums v-for="album in genreAlbums.items" :key="album.id" :album="album" :links="links"></list-item-albums>
|
|
</template>
|
|
</content-with-heading>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { LoadDataBeforeEnterMixin } from './mixin'
|
|
import ContentWithHeading from '@/templates/ContentWithHeading'
|
|
import TabsMusic from '@/components/TabsMusic'
|
|
import ListItemAlbums from '@/components/ListItemAlbum'
|
|
import webapi from '@/webapi'
|
|
|
|
const genreData = {
|
|
load: function (to) {
|
|
return webapi.library_genre(to.params.genre)
|
|
},
|
|
|
|
set: function (vm, response) {
|
|
vm.name = vm.$route.params.genre
|
|
vm.genreAlbums = response.data.albums
|
|
var li = 0
|
|
var v = null
|
|
var i
|
|
for (i = 0; i < vm.genreAlbums.items.length; i++) {
|
|
var n = vm.genreAlbums.items[i].name_sort.charAt(0).toUpperCase()
|
|
if (n !== v) {
|
|
var obj = {}
|
|
obj.n = n
|
|
obj.a = 'idx_nav_' + li
|
|
vm.links.push(obj)
|
|
li++
|
|
v = n
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
export default {
|
|
name: 'PageGenre',
|
|
mixins: [ LoadDataBeforeEnterMixin(genreData) ],
|
|
components: { ContentWithHeading, TabsMusic, ListItemAlbums },
|
|
|
|
data () {
|
|
return {
|
|
name: '',
|
|
genreAlbums: {},
|
|
links: []
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
open_tracks: function () {
|
|
this.show_details_modal = false
|
|
this.$router.push({ path: '/music/genres/' + this.name + '/tracks' })
|
|
},
|
|
|
|
play: function () {
|
|
webapi.player_play_uri(this.genreAlbums.items.map(a => a.uri).join(','), true)
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
</style>
|