2018-10-26 16:17:18 +01:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<content-with-heading>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #options>
|
2022-02-19 07:47:54 +01:00
|
|
|
<index-button-list :index="albums_list.indexList" />
|
2018-12-19 13:02:38 +01:00
|
|
|
</template>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #heading-left>
|
|
|
|
<p class="title is-4">
|
|
|
|
{{ name }}
|
|
|
|
</p>
|
2018-10-26 16:17:18 +01:00
|
|
|
</template>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #heading-right>
|
2019-02-20 09:22:17 +01:00
|
|
|
<div class="buttons is-centered">
|
2022-02-19 06:39:14 +01:00
|
|
|
<a
|
|
|
|
class="button is-small is-light is-rounded"
|
|
|
|
@click="show_genre_details_modal = true"
|
|
|
|
>
|
|
|
|
<span class="icon"
|
|
|
|
><i class="mdi mdi-dots-horizontal mdi-18px"
|
|
|
|
/></span>
|
2019-02-20 09:22:17 +01:00
|
|
|
</a>
|
|
|
|
<a class="button is-small is-dark is-rounded" @click="play">
|
2022-02-19 06:39:14 +01:00
|
|
|
<span class="icon"><i class="mdi mdi-shuffle" /></span>
|
|
|
|
<span>Shuffle</span>
|
2019-02-20 09:22:17 +01:00
|
|
|
</a>
|
|
|
|
</div>
|
2018-10-26 16:17:18 +01:00
|
|
|
</template>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #content>
|
|
|
|
<p class="heading has-text-centered-mobile">
|
2022-02-19 07:47:54 +01:00
|
|
|
{{ albums_list.total }} albums |
|
2022-02-19 06:39:14 +01:00
|
|
|
<a class="has-text-link" @click="open_tracks">tracks</a>
|
|
|
|
</p>
|
2022-02-19 07:47:54 +01:00
|
|
|
<list-albums :albums="albums_list" />
|
2022-02-19 06:39:14 +01:00
|
|
|
<modal-dialog-genre
|
|
|
|
:show="show_genre_details_modal"
|
|
|
|
:genre="{ name: name }"
|
|
|
|
@close="show_genre_details_modal = false"
|
|
|
|
/>
|
2018-10-26 16:17:18 +01:00
|
|
|
</template>
|
|
|
|
</content-with-heading>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-02-19 06:18:01 +01:00
|
|
|
import ContentWithHeading from '@/templates/ContentWithHeading.vue'
|
|
|
|
import IndexButtonList from '@/components/IndexButtonList.vue'
|
|
|
|
import ListAlbums from '@/components/ListAlbums.vue'
|
|
|
|
import ModalDialogGenre from '@/components/ModalDialogGenre.vue'
|
2018-10-26 16:17:18 +01:00
|
|
|
import webapi from '@/webapi'
|
2022-02-19 07:47:54 +01:00
|
|
|
import { bySortName, GroupByList } from '@/lib/GroupByList'
|
2018-10-26 16:17:18 +01:00
|
|
|
|
2022-02-19 06:18:01 +01:00
|
|
|
const dataObject = {
|
2018-10-26 16:17:18 +01:00
|
|
|
load: function (to) {
|
|
|
|
return webapi.library_genre(to.params.genre)
|
|
|
|
},
|
|
|
|
|
|
|
|
set: function (vm, response) {
|
|
|
|
vm.name = vm.$route.params.genre
|
2022-02-19 07:47:54 +01:00
|
|
|
vm.albums_list = new GroupByList(response.data.albums)
|
|
|
|
vm.albums_list.group(bySortName('name_sort'))
|
2018-10-26 16:17:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'PageGenre',
|
2022-02-19 06:39:14 +01:00
|
|
|
components: {
|
|
|
|
ContentWithHeading,
|
|
|
|
IndexButtonList,
|
|
|
|
ListAlbums,
|
|
|
|
ModalDialogGenre
|
|
|
|
},
|
|
|
|
|
|
|
|
beforeRouteEnter(to, from, next) {
|
|
|
|
dataObject.load(to).then((response) => {
|
|
|
|
next((vm) => dataObject.set(vm, response))
|
|
|
|
})
|
|
|
|
},
|
|
|
|
beforeRouteUpdate(to, from, next) {
|
2022-02-19 07:47:54 +01:00
|
|
|
if (!this.albums_list.isEmpty()) {
|
|
|
|
next()
|
|
|
|
return
|
|
|
|
}
|
2022-02-19 06:39:14 +01:00
|
|
|
const vm = this
|
|
|
|
dataObject.load(to).then((response) => {
|
|
|
|
dataObject.set(vm, response)
|
|
|
|
next()
|
|
|
|
})
|
|
|
|
},
|
2018-10-26 16:17:18 +01:00
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
data() {
|
2018-10-26 16:17:18 +01:00
|
|
|
return {
|
|
|
|
name: '',
|
2022-02-19 07:47:54 +01:00
|
|
|
albums_list: new GroupByList(),
|
2018-12-15 09:56:09 +01:00
|
|
|
|
2019-02-20 09:22:17 +01:00
|
|
|
show_genre_details_modal: false
|
2018-10-26 16:17:18 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
2018-11-24 16:22:23 +00:00
|
|
|
open_tracks: function () {
|
|
|
|
this.show_details_modal = false
|
2019-02-17 11:33:23 +01:00
|
|
|
this.$router.push({ name: 'GenreTracks', params: { genre: this.name } })
|
2018-11-24 16:22:23 +00:00
|
|
|
},
|
|
|
|
|
2018-10-26 16:17:18 +01:00
|
|
|
play: function () {
|
2022-02-19 06:39:14 +01:00
|
|
|
webapi.player_play_expression(
|
|
|
|
'genre is "' + this.name + '" and media_kind is music',
|
|
|
|
true
|
|
|
|
)
|
2018-10-26 16:17:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
<style></style>
|