koel/resources/assets/js/components/shared/song-list-controls.vue

108 lines
2.3 KiB
Vue
Raw Normal View History

2016-11-17 07:07:12 +00:00
<template>
<div class="buttons song-list-controls">
2016-11-17 09:25:58 +00:00
<button class="btn btn-orange btn-shuffle-all"
2016-11-17 07:07:12 +00:00
@click.prevent="shuffle"
2016-11-18 06:30:30 +00:00
v-if="fullConfig.shuffle && selectedSongs.length < 2">
2016-11-17 07:07:12 +00:00
<i class="fa fa-random"></i> All
</button>
2016-11-17 09:25:58 +00:00
<button class="btn btn-orange btn-shuffle-selected"
2016-11-17 07:07:12 +00:00
@click.prevent="shuffleSelected"
2016-11-18 06:30:30 +00:00
v-if="fullConfig.shuffle && selectedSongs.length > 1">
2016-11-17 07:07:12 +00:00
<i class="fa fa-random"></i> Selected
</button>
2016-11-17 09:25:58 +00:00
<button class="btn btn-green btn-add-to"
2016-11-17 07:07:12 +00:00
@click.prevent.stop="showingAddToMenu = !showingAddToMenu"
v-if="selectedSongs.length">
{{ showingAddToMenu ? 'Cancel' : 'Add To…' }}
</button>
2016-11-17 09:25:58 +00:00
<button class="btn btn-red btn-clear-queue"
2016-11-17 07:07:12 +00:00
@click.prevent="clearQueue"
v-if="showClearQueueButton">
Clear
</button>
2016-11-17 09:25:58 +00:00
<button class="del btn btn-red btn-delete-playlist" v-if="showDeletePlaylistButton"
2016-11-17 07:07:12 +00:00
title="Delete this playlist"
@click.prevent="deletePlaylist">
<i class="fa fa-times"></i> Playlist
</button>
<add-to-menu v-koel-clickaway="closeAddToMenu"
:config="fullConfig.addTo"
:songs="selectedSongs"
:showing="showingAddToMenu"
/>
</div>
</template>
<script>
2016-11-26 03:25:35 +00:00
import { assign } from 'lodash'
import addToMenu from './add-to-menu.vue'
2016-11-17 07:07:12 +00:00
export default {
name: 'shared--song-list-controls',
props: ['config', 'selectedSongs'],
components: { addToMenu },
2016-11-26 03:25:35 +00:00
data () {
2016-11-17 07:07:12 +00:00
return {
fullConfig: {
shuffle: true,
addTo: {
queue: true,
favorites: true,
playlists: true,
2016-11-26 03:25:35 +00:00
newPlaylist: true
2016-11-17 07:07:12 +00:00
},
clearQueue: false,
deletePlaylist: false
},
showingAddToMenu: false,
numberOfQueuedSongs: 0
2016-11-26 03:25:35 +00:00
}
2016-11-17 07:07:12 +00:00
},
computed: {
2016-11-26 03:25:35 +00:00
showClearQueueButton () {
return this.fullConfig.clearQueue
2016-11-17 07:07:12 +00:00
},
2016-11-26 03:25:35 +00:00
showDeletePlaylistButton () {
return this.fullConfig.deletePlaylist
}
2016-11-17 07:07:12 +00:00
},
2016-11-26 03:25:35 +00:00
mounted () {
assign(this.fullConfig, this.config)
2016-11-17 07:07:12 +00:00
},
methods: {
2016-11-26 03:25:35 +00:00
shuffle () {
this.$emit('shuffleAll')
2016-11-17 07:07:12 +00:00
},
2016-11-26 03:25:35 +00:00
shuffleSelected () {
this.$emit('shuffleSelected')
2016-11-17 07:07:12 +00:00
},
2016-11-26 03:25:35 +00:00
clearQueue () {
this.$emit('clearQueue')
2016-11-17 07:07:12 +00:00
},
2016-11-26 03:25:35 +00:00
deletePlaylist () {
this.$emit('deletePlaylist')
2016-11-17 07:07:12 +00:00
},
2016-11-26 03:25:35 +00:00
closeAddToMenu () {
this.showingAddToMenu = false
2016-11-17 07:07:12 +00:00
}
}
2016-11-26 03:25:35 +00:00
}
2016-11-17 07:07:12 +00:00
</script>
2016-11-17 08:37:12 +00:00
<style lang="sass"></style>