koel/resources/assets/js/components/shared/album-item.vue

64 lines
1.6 KiB
Vue
Raw Normal View History

2015-12-13 04:42:28 +00:00
<template>
<article class="item" v-if="album.songs.length">
<span class="cover" :style="{ backgroundImage: 'url(' + album.cover + ')' }">
<a class="control" @click.prevent="play">
<i class="fa fa-play"></i>
</a>
</span>
<footer>
2016-01-15 07:27:25 +00:00
<a class="name" @click.prevent="viewDetails">{{ album.name }}</a>
<a class="artist" @click.prevent="viewArtistDetails">{{ album.artist.name }}</a>
2015-12-13 04:42:28 +00:00
<p class="meta">
2016-01-15 10:05:54 +00:00
{{ album.songs.length }} {{ album.songs.length | pluralize 'song' }}
2016-01-15 07:27:25 +00:00
2015-12-13 04:42:28 +00:00
{{ album.fmtLength }}
</p>
</footer>
</article>
</template>
<script>
import playback from '../../services/playback';
export default {
props: ['album'],
methods: {
/**
* Play all songs in the current album.
*/
play() {
playback.playAllInAlbum(this.album);
2015-12-13 04:42:28 +00:00
},
2016-01-15 07:27:25 +00:00
/**
* Load the album details screen.
*/
viewDetails() {
this.$root.loadAlbum(this.album);
},
/**
* Load the artist details screen.
*/
viewArtistDetails() {
this.$root.loadArtist(this.album.artist);
},
2015-12-13 04:42:28 +00:00
},
};
</script>
<style lang="sass">
@import "resources/assets/sass/partials/_vars.scss";
@import "resources/assets/sass/partials/_mixins.scss";
2016-01-15 07:27:25 +00:00
a.name, a.artist {
display: block;
color: $colorMainText;
&:hover {
color: $colorHighlight;
}
}
2015-12-13 04:42:28 +00:00
</style>