Fixed removing/adding to library, label tag
This commit is contained in:
@ -37,7 +37,7 @@
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
<!-- Add to library -->
|
||||
<v-list-item dense @click='addLibrary'>
|
||||
<v-list-item dense @click='library' v-if='!album.library'>
|
||||
<v-list-item-icon>
|
||||
<v-icon>mdi-heart</v-icon>
|
||||
</v-list-item-icon>
|
||||
@ -45,6 +45,15 @@
|
||||
<v-list-item-title>{{$t("Add to library")}}</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
<!-- Remove from library -->
|
||||
<v-list-item dense @click='library' v-if='album.library'>
|
||||
<v-list-item-icon>
|
||||
<v-icon>mdi-heart-remove</v-icon>
|
||||
</v-list-item-icon>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title>{{$t("Remove from library")}}</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
<!-- Download -->
|
||||
<v-list-item dense @click='download'>
|
||||
<v-list-item-icon>
|
||||
@ -134,9 +143,19 @@ export default {
|
||||
});
|
||||
this.$emit('clicked')
|
||||
},
|
||||
async addLibrary() {
|
||||
await this.$axios.put(`/library/album?id=${this.album.id}`);
|
||||
this.$root.globalSnackbar = this.$t('Added to library!');
|
||||
async library() {
|
||||
if (this.album.library) {
|
||||
//Remove
|
||||
await this.$axios.delete('/library/album?id=' + this.album.id);
|
||||
this.$root.globalSnackbar = this.$t('Removed from library!');
|
||||
this.album.library = false;
|
||||
this.$emit('remove');
|
||||
} else {
|
||||
//Add
|
||||
await this.$axios.put(`/library/album?id=${this.album.id}`);
|
||||
this.$root.globalSnackbar = this.$t('Added to library!');
|
||||
this.album.library = true;
|
||||
}
|
||||
},
|
||||
//Add to downloads
|
||||
async download() {
|
||||
|
@ -18,7 +18,7 @@
|
||||
</template>
|
||||
<v-list dense>
|
||||
<!-- Add library -->
|
||||
<v-list-item dense @click='addLibrary'>
|
||||
<v-list-item dense @click='library' v-if='!artist.library'>
|
||||
<v-list-item-icon>
|
||||
<v-icon>mdi-heart</v-icon>
|
||||
</v-list-item-icon>
|
||||
@ -26,6 +26,15 @@
|
||||
<v-list-item-title>{{$t("Add to library")}}</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
<!-- Remvoe from library -->
|
||||
<v-list-item dense @click='library' v-if='artist.library'>
|
||||
<v-list-item-icon>
|
||||
<v-icon>mdi-heart-remove</v-icon>
|
||||
</v-list-item-icon>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title>{{$t("Remove from library")}}</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
|
||||
@ -67,9 +76,19 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async addLibrary() {
|
||||
await this.$axios.put(`/library/artist&id=${this.artist.id}`);
|
||||
this.$root.globalSnackbar = this.$t('Added to library!');
|
||||
async library() {
|
||||
if (this.artist.library) {
|
||||
//Remove
|
||||
await this.$axios.delete('/library/artist?id=' + this.artist.id);
|
||||
this.$root.globalSnackbar = this.$t('Removed from library!');
|
||||
this.artist.library = false;
|
||||
this.$emit('remove');
|
||||
} else {
|
||||
//Add
|
||||
await this.$axios.put(`/library/artist?id=${this.artist.id}`);
|
||||
this.$root.globalSnackbar = this.$t('Added to library!');
|
||||
this.artist.library = true;
|
||||
}
|
||||
},
|
||||
click() {
|
||||
//Navigate to details
|
||||
|
@ -5,8 +5,8 @@
|
||||
<v-progress-circular indeterminate></v-progress-circular>
|
||||
</v-overlay>
|
||||
|
||||
<v-lazy max-height="100" v-for='album in albums' :key='album.id'>
|
||||
<AlbumTile :album='album'></AlbumTile>
|
||||
<v-lazy max-height="100" v-for='(album, index) in albums' :key='album.id'>
|
||||
<AlbumTile :album='album' @remove='removed(index)'></AlbumTile>
|
||||
</v-lazy>
|
||||
|
||||
</v-list>
|
||||
@ -32,6 +32,9 @@ export default {
|
||||
this.albums = res.data.data;
|
||||
}
|
||||
this.loading = false;
|
||||
},
|
||||
removed(index) {
|
||||
this.albums.splice(index, 1);
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
@ -5,8 +5,8 @@
|
||||
<v-progress-circular indeterminate></v-progress-circular>
|
||||
</v-overlay>
|
||||
|
||||
<v-lazy max-height="100" v-for='artist in artists' :key='artist.id'>
|
||||
<ArtistTile :artist='artist'></ArtistTile>
|
||||
<v-lazy max-height="100" v-for='(artist, index) in artists' :key='artist.id'>
|
||||
<ArtistTile :artist='artist' @remove='removed(index)'></ArtistTile>
|
||||
</v-lazy>
|
||||
|
||||
</v-list>
|
||||
@ -35,6 +35,9 @@ export default {
|
||||
this.artists = res.data.data;
|
||||
}
|
||||
this.loading = false;
|
||||
},
|
||||
removed(index) {
|
||||
this.artists.splice(index, 1);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
@ -36,13 +36,23 @@
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
|
||||
<!-- Add to library -->
|
||||
<v-list-item dense v-if='!canRemove && !playlist.library' @click='library'>
|
||||
<v-list-item-icon>
|
||||
<v-icon>mdi-heart</v-icon>
|
||||
</v-list-item-icon>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title>{{$t('Add to library')}}</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
|
||||
<!-- Remove -->
|
||||
<v-list-item dense v-if='canRemove' @click='remove'>
|
||||
<v-list-item-icon>
|
||||
<v-icon>mdi-playlist-remove</v-icon>
|
||||
</v-list-item-icon>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title>{{$t('Remove')}}</v-list-item-title>
|
||||
<v-list-item-title>{{$t('Remove from library')}}</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
|
||||
@ -157,12 +167,17 @@ export default {
|
||||
}
|
||||
this.tracks = tracks;
|
||||
this.downloadDialog = true;
|
||||
},
|
||||
async library() {
|
||||
await this.$axios.put(`/library/playlist?id=${this.playlist.id}`);
|
||||
this.$root.globalSnackbar = this.$t('Added to library!');
|
||||
this.playlist.library = true;
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
canRemove() {
|
||||
//Own playlist
|
||||
if (this.$root.profile.id == this.playlist.user.id) return true;
|
||||
if (this.$root.profile.id == this.playlist.user.id || this.playlist.library) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user