Skip to content
Snippets Groups Projects
Commit 97718587 authored by Ciarán Ainsworth's avatar Ciarán Ainsworth
Browse files

Resolve "Add a "Replace current playlist" option"

parent a6a649d4
No related branches found
No related tags found
No related merge requests found
Added the option to replace the queue's current contents with a selected album or track (#761)
\ No newline at end of file
......@@ -19,7 +19,11 @@
<i class="step forward icon"></i>{{ labels.playNext }}
</button>
<button class="item basic" ref="playNow" data-ref="playNow" :disabled="!playable" @click.stop.prevent="addNext(true)" :title="labels.playNow">
<i class="play icon"></i>{{ labels.playNow }}</button>
<i class="play icon"></i>{{ labels.playNow }}
</button>
<button class="item basic" ref="replacePlay" data-ref="replacePlay" :disabled="!playable" @click.stop.prevent="replacePlay()" :title="labels.replacePlay">
<i class="list icon"></i>{{ labels.replacePlay }}
</button>
<button v-if="track" class="item basic" :disabled="!playable" @click.stop.prevent="$store.dispatch('radios/start', {type: 'similar', objectId: track.id})" :title="labels.startRadio">
<i class="feed icon"></i><translate translate-context="*/Queue/Button.Label/Short, Verb">Start radio</translate>
</button>
......@@ -74,7 +78,8 @@ export default {
playNow: this.$pgettext('*/Queue/Dropdown/Button/Title', 'Play now'),
addToQueue: this.$pgettext('*/Queue/Dropdown/Button/Title', 'Add to current queue'),
playNext: this.$pgettext('*/Queue/Dropdown/Button/Title', 'Play next'),
startRadio: this.$pgettext('*/Queue/Dropdown/Button/Title', 'Play similar songs')
startRadio: this.$pgettext('*/Queue/Dropdown/Button/Title', 'Play similar songs'),
replacePlay: this.$pgettext('*/Queue/Dropdown/Button/Title', 'Replace current queue')
}
},
title () {
......@@ -201,6 +206,14 @@ export default {
})
jQuery(self.$el).find('.ui.dropdown').dropdown('hide')
},
replacePlay () {
let self = this
self.$store.dispatch('queue/clean')
this.getPlayableTracks().then((tracks) => {
self.$store.dispatch('queue/appendMany', {tracks: tracks}).then(() => self.addMessage(tracks))
})
jQuery(self.$el).find('.ui.dropdown').dropdown('hide')
},
addNext (next) {
let self = this
let wasEmpty = this.$store.state.queue.tracks.length === 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment