From 312c4ed725760674866db8d2e9cfb2215ea0f691 Mon Sep 17 00:00:00 2001 From: Ben Goldsworthy Date: Thu, 20 Feb 2025 01:23:36 +0100 Subject: [PATCH] fix: map in locations view --- layouts/locations/list.html | 52 +++++++------ layouts/partials/cv/locations/heatmap.js | 73 ++++++++++--------- .../leaflet-fullscreen/leaflet.fullscreen.css | 0 3 files changed, 68 insertions(+), 57 deletions(-) rename static/{css => js}/leaflet-fullscreen/leaflet.fullscreen.css (100%) diff --git a/layouts/locations/list.html b/layouts/locations/list.html index 7bb3625..fc5d1ec 100644 --- a/layouts/locations/list.html +++ b/layouts/locations/list.html @@ -1,45 +1,53 @@ {{ define "title" }} - Locations | {{ .Site.Title }} + Locations | + {{ .Site.Title }} {{ end }} {{ define "main-class" }}--section location-map{{ end }} {{ define "header-scripts" }} - - - + + + {{ end }} {{ define "footer-scripts" }} - - + + - - + + - - + + - + {{- partial "cv/locations/heatmap.js" ( dict "all_pages" $.Site.AllPages "locations" $.Site.Data.locations ) -}} {{ end }} {{ define "main-header" }} -
-

{{ .Title | safeHTML }}.

- {{ .Content }} -
+
+

{{ .Title | safeHTML }}.

+ {{ .Content }} +
{{ end }} {{ define "main-body" }} -
-
+
+
{{- with ( partial "util/render_recursive_list.html" ( dict "sc" $ "pc" . "items" $.Site.Data.locations "schemaType" "Place" ) ) -}} -
+
{{- . -}} -
+
{{- end -}} -
+
{{ end }} diff --git a/layouts/partials/cv/locations/heatmap.js b/layouts/partials/cv/locations/heatmap.js index 1465b5a..6427bdb 100644 --- a/layouts/partials/cv/locations/heatmap.js +++ b/layouts/partials/cv/locations/heatmap.js @@ -1,47 +1,50 @@ -/* +{{/* Recursively render an ordered or unordered list from a set of arbitrarily- deeply-nested items. @params all_pages All site pages -*/ - -var map = L.map('map', { - fullscreenControl: true -}).setView([55, -3], 3); - -L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { - maxZoom: 19, - attribution: '© OpenStreetMap' -}).addTo(map); - -{{- $locations := partialCached "util/get_location_leaf_nodes.html" $.Site.Data.locations -}} - -{{/* -{{- range .Site.AllPages -}} - {{- with .Params.locations -}} - {{- range . -}} - {{- with ( index $locations ( replaceRE `, [A-Z]+` "" . ) ) -}} - L.marker([{{ .lat }}, {{ .lon }}]).addTo(map); - {{- end -}} - {{- end -}} - {{- end -}} -{{- end -}} + @params locations All locations */}} -L.heatLayer( - [ - {{- range .all_pages -}} + diff --git a/static/css/leaflet-fullscreen/leaflet.fullscreen.css b/static/js/leaflet-fullscreen/leaflet.fullscreen.css similarity index 100% rename from static/css/leaflet-fullscreen/leaflet.fullscreen.css rename to static/js/leaflet-fullscreen/leaflet.fullscreen.css