Open location: Add place & country fallback

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
Michael Mayer 2020-06-05 17:01:18 +02:00
parent fbf675fbfb
commit e129fab926
2 changed files with 17 additions and 9 deletions

View file

@ -125,10 +125,14 @@
openLocation(index) {
const photo = this.results[index];
if (photo.LocationID) {
if (photo.LocationID && photo.LocationID !== "zz") {
this.$router.push({name: "place", params: {q: photo.LocationID}});
} else if (photo.PlaceID.length > 3) {
} else if (photo.PlaceID && photo.PlaceID !== "zz") {
this.$router.push({name: "place", params: {q: photo.PlaceID}});
} else if (photo.Country && photo.Country !== "zz") {
this.$router.push({name: "place", params: {q: "country:" + photo.Country}});
} else {
this.$notify.warn("unknown location");
}
},
editPhoto(index) {
@ -140,12 +144,12 @@
Event.publish("dialog.edit", {selection: selection, album: this.album, index: index});
},
openPhoto(index, showMerged) {
if(!this.results[index]) {
if (!this.results[index]) {
return false;
}
if (showMerged && (this.results[index].Type === 'video' || this.results[index].Type === 'live')) {
if(this.results[index].isPlayable()) {
if (this.results[index].isPlayable()) {
this.$modal.show('video', {video: this.results[index], album: this.album});
} else {
this.$viewer.show(Thumb.fromPhotos(this.results), index);

View file

@ -3,7 +3,7 @@
:infinite-scroll-distance="10" :infinite-scroll-listen-for-event="'scrollRefresh'">
<p-photo-toolbar :settings="settings" :filter="filter" :filter-change="updateQuery" :dirty="dirty"
:refresh="refresh"></p-photo-toolbar>
:refresh="refresh"></p-photo-toolbar>
<v-container fluid class="pa-4" v-if="loading">
<v-progress-linear color="secondary-dark" :indeterminate="true"></v-progress-linear>
@ -165,10 +165,14 @@
openLocation(index) {
const photo = this.results[index];
if (photo.LocationID) {
if (photo.LocationID && photo.LocationID !== "zz") {
this.$router.push({name: "place", params: {q: photo.LocationID}});
} else if (photo.PlaceID.length > 3) {
} else if (photo.PlaceID && photo.PlaceID !== "zz") {
this.$router.push({name: "place", params: {q: photo.PlaceID}});
} else if (photo.Country && photo.Country !== "zz") {
this.$router.push({name: "place", params: {q: "country:" + photo.Country}});
} else {
this.$notify.warn("unknown location");
}
},
editPhoto(index) {
@ -180,12 +184,12 @@
Event.publish("dialog.edit", {selection: selection, album: null, index: index});
},
openPhoto(index, showMerged) {
if(!this.results[index]) {
if (!this.results[index]) {
return false;
}
if (showMerged && (this.results[index].Type === 'video' || this.results[index].Type === 'live')) {
if(this.results[index].isPlayable()) {
if (this.results[index].isPlayable()) {
this.$modal.show('video', {video: this.results[index], album: null});
} else {
this.$viewer.show(Thumb.fromPhotos(this.results), index);