From 5fba03844298ab501ce513a3f967b7578bc09707 Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Fri, 7 Feb 2020 17:24:24 +0100 Subject: [PATCH] Frontend: Set Modified* flags #243 Signed-off-by: Michael Mayer --- frontend/src/model/photo.js | 29 ++++++++++++++++++++++++++--- frontend/src/resources/themes.json | 2 +- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/frontend/src/model/photo.js b/frontend/src/model/photo.js index afb284a40..09d436e30 100644 --- a/frontend/src/model/photo.js +++ b/frontend/src/model/photo.js @@ -11,7 +11,6 @@ class Photo extends Abstract { PhotoPath: "", PhotoName: "", PhotoTitle: "", - PhotoTitleChanged: false, PhotoDescription: "", PhotoNotes: "", PhotoArtist: "", @@ -37,13 +36,15 @@ class Photo extends Abstract { LocationID: "", Place: null, PlaceID: "", - LocationChanged: false, LocationEstimated: false, PhotoCountry: "", PhotoYear: 0, PhotoMonth: 0, TakenAtLocal: "", - TakenAtChanged: false, + ModifiedDate: false, + ModifiedTitle: false, + ModifiedDetails: false, + ModifiedLocation: false, TimeZone: "", Files: [], Labels: [], @@ -219,6 +220,28 @@ class Photo extends Abstract { .then((response) => Promise.resolve(this.setValues(response.data))); } + update() { + const values = this.getValues(true); + + if(values.PhotoTitle) { + values.ModifiedTitle = true + } + + if(values.PhotoLat || values.PhotoLng || values.PhotoAltitude) { + values.ModifiedLocation = true + } + + if(values.TakenAt || values.TimeZone) { + values.ModifiedDate = true + } + + if(values.CameraID || values.LensID || values.PhotoCountry) { + values.ModifiedDetails = true + } + + return Api.put(this.getEntityResource(), values).then((response) => Promise.resolve(this.setValues(response.data))); + } + static getCollectionResource() { return "photos"; } diff --git a/frontend/src/resources/themes.json b/frontend/src/resources/themes.json index c72bf36ba..5dcdd596e 100644 --- a/frontend/src/resources/themes.json +++ b/frontend/src/resources/themes.json @@ -143,7 +143,7 @@ "primary": "#c8bdb1", "secondary-dark": "#353839", "secondary": "#A8A8A8", - "secondary-light": "#B8B8B8", + "secondary-light": "#cdccca", "accent": "#656565", "error": "#FF76DC", "info": "#5A94DD",