1.1.13 (what is a descriptive commit message?)
This commit is contained in:
@ -2,9 +2,10 @@
|
||||
<div>
|
||||
|
||||
<!-- Create playlist -->
|
||||
<v-card class='text-center pa-2' v-if='!addToPlaylist'>
|
||||
<v-card class='text-center pa-2' v-if='edit || !addToPlaylist'>
|
||||
<v-card-text>
|
||||
<p primary-title class='display-1'>{{$t("Create playlist")}}</p>
|
||||
<p v-if='!edit' primary-title class='display-1'>{{$t("Create playlist")}}</p>
|
||||
<p v-if='edit' primary-title class='display-1'>{{$t("Edit playlist")}}</p>
|
||||
<v-text-field label='Title' class='ma-2' v-model='title'></v-text-field>
|
||||
<v-textarea class='mx-2' v-model='description' label='Description' rows='1' auto-grow></v-textarea>
|
||||
<v-select class='mx-2' v-model='type' :items='types' label='Type'></v-select>
|
||||
@ -12,12 +13,15 @@
|
||||
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn class='primary' :loading='createLoading' @click='create'>{{$t("Create")}}</v-btn>
|
||||
<v-btn class='primary' :loading='createLoading' @click='create'>
|
||||
<div v-if='!edit'>{{$t("Create")}}</div>
|
||||
<div v-if='edit'>{{$t("Save")}}</div>
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
|
||||
<!-- Add to playlist -->
|
||||
<v-card class='text-center pa-2' v-if='addToPlaylist'>
|
||||
<v-card class='text-center pa-2' v-if='addToPlaylist && !edit'>
|
||||
<v-card-text>
|
||||
<p primary-title class='display-1'>{{$t("Add to playlist")}}</p>
|
||||
<v-btn block class='mb-1' @click='addToPlaylist = false'>
|
||||
@ -54,10 +58,10 @@ export default {
|
||||
//Make mutable
|
||||
addToPlaylist: this.track?true:false,
|
||||
|
||||
title: '',
|
||||
description: '',
|
||||
type: 'Private',
|
||||
types: ['Private', 'Public'],
|
||||
title: this.playlist ? this.playlist.title : '',
|
||||
description: this.playlist ? this.playlist.description : '',
|
||||
type: this.$t('Private'),
|
||||
types: [this.$t('Public'), this.$t('Private'), this.$t('Collaborative')],
|
||||
createLoading: false,
|
||||
|
||||
loading: false,
|
||||
@ -68,24 +72,44 @@ export default {
|
||||
track: {
|
||||
type: Object,
|
||||
default: null
|
||||
},
|
||||
//If editing playlist
|
||||
edit: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
//For editting
|
||||
playlist: {
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
//Create playlist
|
||||
async create() {
|
||||
this.createLoading = true;
|
||||
|
||||
await this.$axios.post('/playlist', {
|
||||
description: this.description,
|
||||
title: this.title,
|
||||
type: this.type.toLowerCase(),
|
||||
track: this.track ? this.track.id : null
|
||||
});
|
||||
if (this.edit) {
|
||||
await this.$axios.put('/playlist/' + this.playlist.id, {
|
||||
description: this.description,
|
||||
title: this.title,
|
||||
type: this.types.indexOf(this.type),
|
||||
});
|
||||
} else {
|
||||
await this.$axios.post('/playlist', {
|
||||
description: this.description,
|
||||
title: this.title,
|
||||
type: this.types.indexOf(this.type),
|
||||
track: this.track ? this.track.id : null
|
||||
});
|
||||
}
|
||||
|
||||
this.createLoading = false;
|
||||
this.$emit('created');
|
||||
this.$emit('close');
|
||||
this.$root.globalSnackbar = this.$t('Added to playlist!');
|
||||
if (this.edit)
|
||||
this.$emit("edit");
|
||||
else
|
||||
this.$root.globalSnackbar = this.$t('Added to playlist!');
|
||||
},
|
||||
//Add track to playlist
|
||||
async addTrack(playlist) {
|
||||
|
Reference in New Issue
Block a user