Frontend: Don't flag new albums as favorite by default #753

This commit is contained in:
Michael Mayer 2020-12-30 14:53:17 +01:00
parent d4139d6a78
commit d09c23addc
4 changed files with 29 additions and 29 deletions

View file

@ -495,7 +495,7 @@ export default {
},
createAlbum() {
let name = "New Album";
const album = new Album({Title: name, Favorite: true});
const album = new Album({Title: name, Favorite: false});
album.save();
},
logout() {

View file

@ -1,11 +1,11 @@
<template>
<v-dialog lazy v-model="show" persistent max-width="350" class="p-photo-album-dialog" @keydown.esc="cancel">
<v-dialog v-model="show" lazy persistent max-width="350" class="p-photo-album-dialog" @keydown.esc="cancel">
<v-card raised elevation="24">
<v-container fluid class="pb-2 pr-2 pl-2">
<v-layout row wrap>
<v-flex xs3 text-xs-center>
<v-icon size="54" color="secondary-dark lighten-1" v-if="!album">create_new_folder</v-icon>
<v-icon size="54" color="secondary-dark lighten-1" v-else>folder_special</v-icon>
<v-icon v-if="!album" size="54" color="secondary-dark lighten-1">create_new_folder</v-icon>
<v-icon v-else size="54" color="secondary-dark lighten-1">folder_special</v-icon>
</v-flex>
<v-flex xs9 text-xs-left align-self-center>
<v-autocomplete
@ -27,11 +27,11 @@
</v-autocomplete>
</v-flex>
<v-flex xs12 text-xs-right class="pt-3">
<v-btn @click.stop="cancel" depressed color="secondary-light" class="action-cancel">
<v-btn depressed color="secondary-light" class="action-cancel" @click.stop="cancel">
<translate>Cancel</translate>
</v-btn>
<v-btn color="secondary-dark" depressed dark @click.stop="confirm"
class="action-confirm">
<v-btn color="secondary-dark" depressed dark class="action-confirm"
@click.stop="confirm">
<span v-if="!album">{{ labels.createAlbum }}</span>
<span v-else>{{ labels.addToAlbum }}</span>
</v-btn>
@ -45,7 +45,7 @@
import Album from "model/album";
export default {
name: 'p-photo-album-dialog',
name: 'PPhotoAlbumDialog',
props: {
show: Boolean,
},
@ -61,6 +61,24 @@ export default {
addToAlbum: this.$gettext("Add to album"),
createAlbum: this.$gettext("Create album"),
}
};
},
watch: {
search(q) {
const exists = this.albums.findIndex((album) => album.Title === q);
if (exists !== -1 || !q) {
this.items = this.albums;
this.newAlbum = null;
} else {
this.newAlbum = new Album({Title: q, UID: "", Favorite: false});
this.items = this.albums.concat([this.newAlbum]);
}
},
show: function (show) {
if (show) {
this.queryServer("");
}
}
},
methods: {
@ -105,23 +123,5 @@ export default {
}).catch(() => this.loading = false);
},
},
watch: {
search(q) {
const exists = this.albums.findIndex((album) => album.Title === q);
if (exists !== -1 || !q) {
this.items = this.albums;
this.newAlbum = null;
} else {
this.newAlbum = new Album({Title: q, UID: "", Favorite: true});
this.items = this.albums.concat([this.newAlbum]);
}
},
show: function (show) {
if (show) {
this.queryServer("");
}
}
},
}
};
</script>

View file

@ -56,7 +56,7 @@ export class Album extends RestModel {
Day: -1,
Year: -1,
Month: -1,
Favorite: true,
Favorite: false,
Private: false,
PhotoCount: 0,
LinkCount: 0,

View file

@ -527,7 +527,7 @@ export default {
title = `${title} (${existing.length + 1})`;
}
const album = new Album({"Title": title, "Favorite": true});
const album = new Album({"Title": title, "Favorite": false});
album.save();
},