koel/resources/assets/js/components/main-wrapper/extra/album-info.vue

89 lines
2 KiB
Vue
Raw Normal View History

<template>
2016-06-25 16:05:24 +00:00
<article id="albumInfo" :class="mode">
<h1 class="name">
<span>{{ album.name }}</span>
2016-06-25 16:05:24 +00:00
<a class="shuffle" @click.prevent="shuffleAll"><i class="fa fa-random"></i></a>
</h1>
2016-06-25 16:05:24 +00:00
<div v-if="album.info">
2016-10-31 04:28:12 +00:00
<img v-if="album.info.image" :src="album.info.image" class="cover">
2016-06-25 16:05:24 +00:00
<div class="wiki" v-if="album.info.wiki && album.info.wiki.summary">
2016-10-31 05:00:26 +00:00
<div class="summary" v-show="showSummary" v-html="album.info.wiki.summary"/>
<div class="full" v-show="showFull" v-html="album.info.wiki.full"/>
2016-10-31 05:00:26 +00:00
<button class="more" v-show="showSummary" @click.prevent="showingFullWiki = true">
2016-06-25 16:05:24 +00:00
Full Wiki
</button>
</div>
2016-06-25 16:05:24 +00:00
<section class="track-listing" v-if="album.info.tracks.length">
<h1>Track Listing</h1>
<ul class="tracks">
<li is="track-list-item"
v-for="(track, idx) in album.info.tracks"
:album="album"
:track="track"
:index="idx"
/>
2016-06-25 16:05:24 +00:00
</ul>
</section>
2016-06-25 16:05:24 +00:00
<footer>Data &copy; <a target="_blank" :href="album.info.url">Last.fm</a></footer>
</div>
2016-06-25 16:05:24 +00:00
<p class="none" v-else>No album information found.</p>
</article>
</template>
<script>
2016-11-26 03:25:35 +00:00
import { playback } from '../../../services'
import trackListItem from '../../shared/track-list-item.vue'
2016-06-25 16:05:24 +00:00
export default {
props: ['album', 'mode'],
components: { trackListItem },
2016-11-26 03:25:35 +00:00
data () {
2016-06-25 16:05:24 +00:00
return {
2016-11-26 03:25:35 +00:00
showingFullWiki: false
}
2016-06-25 16:05:24 +00:00
},
2016-09-23 09:55:20 +00:00
watch: {
2016-11-26 03:25:35 +00:00
album () {
this.showingFullWiki = false
}
2016-09-23 09:55:20 +00:00
},
2016-10-31 08:15:32 +00:00
computed: {
2016-11-26 03:25:35 +00:00
showSummary () {
return this.mode !== 'full' && !this.showingFullWiki
2016-10-31 05:00:26 +00:00
},
2016-11-26 03:25:35 +00:00
showFull () {
return this.mode === 'full' || this.showingFullWiki
}
2016-10-31 05:00:26 +00:00
},
2016-09-23 09:55:20 +00:00
methods: {
2016-06-25 16:05:24 +00:00
/**
* Shuffle all songs in the current album.
*/
2016-11-26 03:25:35 +00:00
shuffleAll () {
playback.playAllInAlbum(this.album)
}
}
}
</script>
<style lang="sass">
2016-06-25 16:05:24 +00:00
@import "../../../../sass/partials/_vars.scss";
@import "../../../../sass/partials/_mixins.scss";
2016-06-25 16:05:24 +00:00
#albumInfo {
@include artist-album-info();
}
</style>