From 63eb00bf4a8007a0a2e6c877988874d28fa34f49 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Mon, 4 Nov 2024 08:36:57 -0800 Subject: [PATCH] Clean up the photo parameters table Add a .no-value style to the items in the table. Streamline the logic for filling in table values. --- assets/css/050_photos.css | 8 +- layouts/partials/photostream/exif_table.html | 78 ++++++++++++-------- layouts/photos/single.html | 2 +- 3 files changed, 55 insertions(+), 33 deletions(-) diff --git a/assets/css/050_photos.css b/assets/css/050_photos.css index 491a23b..8b28800 100644 --- a/assets/css/050_photos.css +++ b/assets/css/050_photos.css @@ -9,9 +9,6 @@ } .photo-params { - --background-color: var(--gray7); - --container-background-color: var(--gray6); - --color: var(--gray2); --border-color: var(--gray6); --border-style: 2px solid; @@ -76,6 +73,11 @@ .location { border-right: 0; } + + .no-value { + color: var(--text-color-secondary); + text-align: center; + } } } diff --git a/layouts/partials/photostream/exif_table.html b/layouts/partials/photostream/exif_table.html index fa8cbb3..f1efffd 100644 --- a/layouts/partials/photostream/exif_table.html +++ b/layouts/partials/photostream/exif_table.html @@ -13,23 +13,30 @@ {{ end }} - {{ with .Tags.LensModel }} - - {{ . }} - + {{ with .Tags.LensModel -}} + {{ . }} {{ end }} {{- $hasLocation := and .Lat .Long -}} + {{- $hasPixelDimensions := and .Tags.PixelXDimension .Tags.PixelYDimension -}} {{ if $hasLocation -}} - - {{ $lat := float .Lat }}{{ $latDir := cond (eq $lat 0) "" (cond (gt $lat 0) "N" "S") }} - {{ .Lat | lang.FormatNumber (cond (ne $lat 0) 3 0) }}º{{ $latDir }}, - {{ $long := float .Long }}{{ $longDir := cond (eq $long 0) "" (cond (gt $long 0) "E" "W") }} - {{ .Long | lang.FormatNumber (cond (ne $long 0) 3 0) }}º{{ $longDir }} - + + {{ $latitude := float .Lat }} + {{ $latitudeDirection := cond (eq $latitude 0) "" (cond (gt $latitude 0) "N" "S") }} + + {{ $latitude | lang.FormatNumber (cond (ne $latitude 0) 3 0) }}º{{ $latitudeDirection }} + , + {{ $longitude := float .Long }} + {{ $longitudeDirection := cond (eq $longitude 0) "" (cond (gt $longitude 0) "E" "W") }} + + {{ $longitude | lang.FormatNumber (cond (ne $longitude 0) 3 0) }}º{{ $longitudeDirection }} + + {{- end -}} - {{ if and .Tags.PixelXDimension .Tags.PixelYDimension -}} - + {{ if $hasPixelDimensions -}} + {{- $widthpx := .Tags.PixelXDimension -}} {{- $heightpx := .Tags.PixelYDimension -}} {{- if and (gt $widthpx 0) (gt $heightpx 0) -}} @@ -41,24 +48,37 @@ {{ end }} - {{ if or .Tags.ISOSpeedRatings .Tags.FocalLengthIn35mmFilm .Tags.FNumber .Tags.ExposureTime }} - - {{ with .Tags.ISOSpeedRatings }}ISO {{ . }}{{ end }} - - {{- $focalLength := .Tags.FocalLengthIn35mmFilm | default .Tags.FocalLength -}} - {{- with $focalLength -}}{{ . }} mm{{- end -}} - - {{ with .Tags.FNumber }}{{ printf "ƒ%0.1f" . }}{{ end }} - - {{- with $exposureTime := .Tags.ExposureTime -}} - {{- if in $exposureTime "/" -}} - {{ . }} s - {{- else -}} - 1/{{ printf "%.0f" (div 1.0 (float $exposureTime)) }} s - {{- end -}} + {{ if or + .Tags.ISOSpeedRatings + .Tags.FocalLengthIn35mmFilm + .Tags.FocalLength + .Tags.FNumber + .Tags.ExposureTime + }} + + {{ with .Tags.ISOSpeedRatings -}} + ISO {{ . }} + {{ else }} + -- {{- end -}} - - + + {{- with .Tags.FocalLengthIn35mmFilm | default .Tags.FocalLength -}} + {{ printf "%3.2f" (float .) }} mm + {{- end -}} + + + {{ with .Tags.FNumber }}{{ printf "ƒ%0.1f" (float .) }}{{ end }} + + + {{- with $exposureTime := .Tags.ExposureTime -}} + {{- if in $exposureTime "/" -}} + {{ . }} s + {{- else -}} + 1/{{ printf "%.0f" (div 1.0 (float $exposureTime)) }} s + {{- end -}} + {{- end -}} + + {{ end }} diff --git a/layouts/photos/single.html b/layouts/photos/single.html index 5fbe5c3..7358da0 100644 --- a/layouts/photos/single.html +++ b/layouts/photos/single.html @@ -19,7 +19,7 @@ {{ .Content -}} - {{- if .Params.photo_details | default .Params.photoDetails | default true -}} + {{- if .Params.photoDetails | default .Params.photo_details | default true -}} {{- partial "photostream/exif_table.html" $img.Exif -}} {{- end -}} {{ end }}{{/* if eq (len $images) 1 */}}