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

85 lines
2.5 KiB
Vue
Raw Normal View History

<template>
<article v-if="album.id" id="albumInfo" :class="mode">
<h1 class="name">
2016-02-08 13:14:51 +00:00
<span>{{ album.name }}</span>
<a class="shuffle" @click.prevent="shuffleAll"><i class="fa fa-random"></i></a>
</h1>
2016-02-08 13:14:51 +00:00
<div v-if="album.info">
<img v-if="album.info.image" :src="album.info.image"
title=""
class="cover">
2016-02-08 13:14:51 +00:00
<div class="wiki" v-if="album.info.wiki && album.info.wiki.summary">
<div class="summary" v-show="mode !== 'full' && !showingFullWiki">
{{{ album.info.wiki.summary }}}
</div>
<div class="full" v-show="mode === 'full' || showingFullWiki">
{{{ album.info.wiki.full }}}
</div>
<button class="more" v-show="mode !== 'full' && !showingFullWiki"
@click.prevent="showingFullWiki = !showingFullWiki">
Full Wiki
</button>
</div>
2016-02-08 13:14:51 +00:00
<section class="track-listing" v-if="album.info.tracks.length">
<h1>Track Listing</h1>
<ul class="tracks">
2016-02-08 13:14:51 +00:00
<li v-for="track in album.info.tracks">
<span class="no">{{ $index + 1 }}</span>
<span class="title">{{ track.title }}</span>
<span class="length">{{ track.fmtLength }}</span>
</li>
</ul>
</section>
2016-02-08 13:14:51 +00:00
<footer>Data &copy; <a target="_blank" href="{{{ album.info.url }}}">Last.fm</a></footer>
</div>
<p class="none" v-else>No album information found.</p>
</article>
</template>
<script>
import playback from '../../../services/playback';
export default {
replace: false,
props: ['album', 'mode'],
data() {
return {
showingFullWiki: false,
};
},
methods: {
2016-01-07 09:03:38 +00:00
/**
2016-02-08 13:14:51 +00:00
* Reset the component's current state.
2016-01-07 09:03:38 +00:00
*/
resetState() {
this.showingFullWiki = false;
},
2016-01-07 09:03:38 +00:00
/**
* Shuffle all songs in the current album.
*/
shuffleAll() {
2016-02-08 13:14:51 +00:00
playback.playAllInAlbum(this.album);
},
},
2016-02-08 13:14:51 +00:00
};
</script>
<style lang="sass">
2016-03-13 17:00:32 +00:00
@import "../../../../sass/partials/_vars.scss";
@import "../../../../sass/partials/_mixins.scss";
#albumInfo {
@include artist-album-info();
}
</style>