owntone-server/web-src/src/pages/PageComposers.vue

69 lines
1.6 KiB
Vue
Raw Normal View History

2021-10-23 10:48:11 +01:00
<template>
<div class="fd-page-with-tabs">
<tabs-music />
2021-10-23 10:48:11 +01:00
<content-with-heading>
<template #options>
2024-02-27 16:27:37 +01:00
<index-button-list :indices="composers.indices" />
2021-12-30 11:15:14 +00:00
</template>
<template #heading-left>
2022-05-20 13:44:22 +02:00
<p class="title is-4" v-text="$t('page.composers.title')" />
<p
class="heading"
v-text="$t('page.composers.count', { count: composers.total })"
/>
2021-10-23 10:48:11 +01:00
</template>
<template #content>
<list-composers :composers="composers" />
2021-10-23 10:48:11 +01:00
</template>
</content-with-heading>
</div>
</template>
<script>
import { GroupedList } from '@/lib/GroupedList'
2024-02-28 15:24:55 +01:00
import ContentWithHeading from '@/templates/ContentWithHeading.vue'
2022-02-19 06:18:01 +01:00
import IndexButtonList from '@/components/IndexButtonList.vue'
import ListComposers from '@/components/ListComposers.vue'
import TabsMusic from '@/components/TabsMusic.vue'
2021-10-23 10:48:11 +01:00
import webapi from '@/webapi'
2022-02-19 06:18:01 +01:00
const dataObject = {
load(to) {
return webapi.library_composers('music')
2021-10-23 10:48:11 +01:00
},
set(vm, response) {
vm.composers = new GroupedList(response.data, {
index: { field: 'name_sort', type: String }
})
2021-10-23 10:48:11 +01:00
}
}
export default {
name: 'PageComposers',
components: { ContentWithHeading, IndexButtonList, ListComposers, TabsMusic },
2021-10-23 10:48:11 +01:00
beforeRouteEnter(to, from, next) {
dataObject.load(to).then((response) => {
next((vm) => dataObject.set(vm, response))
})
},
beforeRouteUpdate(to, from, next) {
const vm = this
dataObject.load(to).then((response) => {
dataObject.set(vm, response)
next()
})
},
data() {
2021-10-23 10:48:11 +01:00
return {
2024-02-22 19:32:11 +01:00
composers: new GroupedList()
2021-10-23 10:48:11 +01:00
}
}
2021-10-23 10:48:11 +01:00
}
</script>
<style></style>