mirror of
https://github.com/koel/koel
synced 2024-11-10 22:54:16 +00:00
Refactor
This commit is contained in:
parent
7d9768b846
commit
c9ebda016a
5 changed files with 11 additions and 24 deletions
|
@ -131,9 +131,7 @@
|
|||
* @return {boolean}
|
||||
*/
|
||||
bySameArtist() {
|
||||
return every(this.songs, song => {
|
||||
return song.album.artist.id === this.songs[0].album.artist.id;
|
||||
});
|
||||
return every(this.songs, song => song.album.artist.id === this.songs[0].album.artist.id);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -142,9 +140,7 @@
|
|||
* @return {boolean}
|
||||
*/
|
||||
inSameAlbum() {
|
||||
return every(this.songs, song => {
|
||||
return song.album.id === this.songs[0].album.id;
|
||||
});
|
||||
return every(this.songs, song => song.album.id === this.songs[0].album.id);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -194,11 +194,7 @@
|
|||
// Also, if there's only one song selected, play it right away.
|
||||
// --------------------------------------------------------------------
|
||||
//
|
||||
if (e.shiftKey) {
|
||||
queueStore.queue(songs, false);
|
||||
} else {
|
||||
queueStore.queue(songs, false, false);
|
||||
}
|
||||
queueStore.queue(songs, false, e.shiftKey);
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.$root.loadMainView('queue');
|
||||
|
@ -409,7 +405,8 @@
|
|||
},
|
||||
|
||||
openContextMenu(songId, e) {
|
||||
// If the user is right-click an unselected row, clear the current selection and select it instead.
|
||||
// If the user is right-clicking an unselected row,
|
||||
// clear the current selection and select it instead.
|
||||
const currentRow = this.getComponentBySongId(songId);
|
||||
if (!currentRow.selected) {
|
||||
this.clearSelection();
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
<div class="buttons">
|
||||
<button class="btn btn-blue" @click="edit" v-show="!confirmingDelete">
|
||||
{{ user.id === state.current.id ? 'Update Profile' : 'Edit' }}
|
||||
{{ isCurrentUser ? 'Update Profile' : 'Edit' }}
|
||||
</button>
|
||||
<button v-show="!isCurrentUser && !confirmingDelete"
|
||||
class="btn btn-red" @click="confirmDelete">Delete</button>
|
||||
|
@ -58,7 +58,6 @@
|
|||
|
||||
data() {
|
||||
return {
|
||||
state: userStore.state,
|
||||
editing: false,
|
||||
confirmingDelete: false,
|
||||
cached: {},
|
||||
|
@ -72,7 +71,7 @@
|
|||
* @return {Boolean}
|
||||
*/
|
||||
isCurrentUser() {
|
||||
return this.user.id === this.state.current.id;
|
||||
return this.user.id === userStore.current.id;
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
@ -100,12 +100,7 @@
|
|||
filter.Q.value = 1;
|
||||
filter.frequency.value = f;
|
||||
|
||||
if (!prevFilter) {
|
||||
this.preampGainNode.connect(filter);
|
||||
} else {
|
||||
prevFilter.connect(filter);
|
||||
}
|
||||
|
||||
prevFilter ? prevFilter.connect(filter) : this.preampGainNode.connect(filter);
|
||||
prevFilter = filter;
|
||||
|
||||
this.bands.push({
|
||||
|
@ -152,7 +147,7 @@
|
|||
onSlideEnd: () => {
|
||||
this.selectedPresetIndex = -1;
|
||||
this.save();
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
},
|
||||
|
|
|
@ -118,8 +118,8 @@ export default {
|
|||
return this.queue(songs);
|
||||
}
|
||||
|
||||
// First, make sure we don't have duplicates
|
||||
this.all = difference(this.all, songs);
|
||||
// First we unqueue the songs to make sure there are no duplicates.
|
||||
this.unqueue(songs);
|
||||
|
||||
const head = this.all.splice(0, this.indexOf(this.current) + 1);
|
||||
this.all = head.concat(songs, this.all);
|
||||
|
|
Loading…
Reference in a new issue