1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

Merge pull request #850 from grasdk/master

Feature/location info (#9)
This commit is contained in:
Patrik J. Braun 2024-03-08 00:21:17 +01:00 committed by GitHub
commit 4ac4192bf1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 18 deletions

View File

@ -134,10 +134,10 @@ export class GalleryPhotoComponent implements IRenderable, OnInit, OnDestroy {
}
getPositionText(): string {
if (!this.gridMedia || !this.gridMedia.isPhoto()) {
if (!this.gridMedia || !this.gridMedia.isPhoto() || !(this.gridMedia.media as PhotoDTO).metadata.positionData) {
return '';
}
return (
return ( //not much space in the gridview, so we only deliver city, or state or country
(this.gridMedia.media as PhotoDTO).metadata.positionData.city ||
(this.gridMedia.media as PhotoDTO).metadata.positionData.state ||
(this.gridMedia.media as PhotoDTO).metadata.positionData.country || ''

View File

@ -510,11 +510,14 @@ export class ControlsLightboxComponent implements OnDestroy, OnInit, OnChanges {
case LightBoxTitleTexts.date:
return this.datePipe.transform(m.metadata.creationDate, 'longDate', m.metadata.creationDateOffset);
case LightBoxTitleTexts.location:
return (
m.metadata.positionData?.city ||
m.metadata.positionData?.state ||
m.metadata.positionData?.country || ''
).trim();
if (!m.metadata.positionData) {
return '';
}
return [
m.metadata.positionData.city,
m.metadata.positionData.state,
m.metadata.positionData.country
].filter(elm => elm).join(', ').trim(); //Filter removes empty elements, join concats the values separated by ', '
case LightBoxTitleTexts.camera:
return m.metadata.cameraData?.model;
case LightBoxTitleTexts.lens:

View File

@ -183,17 +183,11 @@ export class InfoPanelLightboxComponent implements OnInit, OnChanges {
if (!(this.media as PhotoDTO).metadata.positionData) {
return '';
}
let str =
(this.media as PhotoDTO).metadata.positionData.city ||
(this.media as PhotoDTO).metadata.positionData.state ||
'';
if (str.length !== 0) {
str += ', ';
}
str += (this.media as PhotoDTO).metadata.positionData.country || '';
return str;
return [
(this.media as PhotoDTO).metadata.positionData.city,
(this.media as PhotoDTO).metadata.positionData.state,
(this.media as PhotoDTO).metadata.positionData.country
].filter(elm => elm).join(', ').trim(); //Filter removes empty elements, join concats the values separated by ', '
}
close(): void {