Upload: Pre-select current album when using mobile nav menu #3784

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer 2023-10-03 16:08:22 +02:00
parent dca3258112
commit 7c86148d0a
5 changed files with 25 additions and 11 deletions

View file

@ -164,7 +164,7 @@ export default [
},
{
name: "moment",
path: "/moments/:uid/:slug",
path: "/moments/:album/:slug",
component: AlbumPhotos,
meta: { collName: "Moments", collRoute: "moments", auth: true },
},
@ -177,7 +177,7 @@ export default [
},
{
name: "album",
path: "/albums/:uid/:slug",
path: "/albums/:album/:slug",
component: AlbumPhotos,
meta: { collName: "Albums", collRoute: "albums", auth: true },
},
@ -190,7 +190,7 @@ export default [
},
{
name: "month",
path: "/calendar/:uid/:slug",
path: "/calendar/:album/:slug",
component: AlbumPhotos,
meta: { collName: "Calendar", collRoute: "calendar", auth: true },
},
@ -203,7 +203,7 @@ export default [
},
{
name: "folder",
path: "/folders/:uid/:slug",
path: "/folders/:album/:slug",
component: AlbumPhotos,
meta: { collName: "Folders", collRoute: "folders", auth: true },
},
@ -292,7 +292,7 @@ export default [
},
{
name: "state",
path: "/states/:uid/:slug",
path: "/states/:album/:slug",
component: AlbumPhotos,
meta: { collName: "Places", collRoute: "states", auth: true },
},

View file

@ -675,6 +675,7 @@
<script>
import Event from "pubsub-js";
import Album from "model/album";
export default {
name: "PNavigation",
@ -817,7 +818,15 @@ export default {
},
openUpload() {
if (this.auth && !this.isReadOnly && this.$config.feature('upload')) {
this.upload.dialog = true;
if (this.$route.params?.album) {
return new Album().find(this.$route.params?.album).then(m => {
this.upload.dialog = true;
this.upload.data = {albums: [m]};
});
} else {
this.upload.dialog = true;
this.upload.data = {};
}
} else {
this.goHome();
}

View file

@ -68,7 +68,7 @@ export class Album extends RestModel {
route(view) {
return {
name: view,
params: { uid: this.UID, slug: "view", year: this.Year, month: this.Month },
params: { album: this.UID, slug: "view", year: this.Year, month: this.Month },
};
}

View file

@ -64,7 +64,7 @@ export default {
},
},
data() {
const uid = this.$route.params.uid;
const uid = this.$route.params.album;
const query = this.$route.query;
const routeName = this.$route.name;
const order = query['order'] ? query['order'] : 'oldest';
@ -143,8 +143,8 @@ export default {
this.routeName = this.$route.name;
if (this.uid !== this.$route.params.uid) {
this.uid = this.$route.params.uid;
if (this.uid !== this.$route.params.album) {
this.uid = this.$route.params.album;
this.findAlbum().then(() => this.search());
} else {
this.search();

View file

@ -471,7 +471,12 @@ export default {
return;
}
Event.publish("dialog.upload");
// Pre-select manually managed album in upload dialog.
if(this.context === 'album' && this.selection && this.selection.length === 1) {
return this.model.find(this.selection[0]).then(m => Event.publish("dialog.upload", {albums: [m]}));
} else {
Event.publish("dialog.upload", {albums: []});
}
},
toggleLike(ev, index) {
if (!this.canManage) {