fix: map in locations view
This commit is contained in:
parent
16e7d6ef83
commit
312c4ed725
3 changed files with 68 additions and 57 deletions
|
@ -1,13 +1,20 @@
|
||||||
{{ define "title" }}
|
{{ define "title" }}
|
||||||
Locations | {{ .Site.Title }}
|
Locations |
|
||||||
|
{{ .Site.Title }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ define "main-class" }}--section location-map{{ end }}
|
{{ define "main-class" }}--section location-map{{ end }}
|
||||||
|
|
||||||
{{ define "header-scripts" }}
|
{{ define "header-scripts" }}
|
||||||
<!-- Leaflet -->
|
<!-- Leaflet -->
|
||||||
<link rel="stylesheet" href="/css/leaflet/leaflet.css" />
|
<link
|
||||||
<link rel="stylesheet" href="/js/leaflet-fullscreen/leaflet.fullscreen.css" />
|
rel="stylesheet"
|
||||||
|
href="/css/leaflet/leaflet.css"
|
||||||
|
/>
|
||||||
|
<link
|
||||||
|
rel="stylesheet"
|
||||||
|
href="/js/leaflet-fullscreen/leaflet.fullscreen.css"
|
||||||
|
/>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ define "footer-scripts" }}
|
{{ define "footer-scripts" }}
|
||||||
|
@ -20,9 +27,7 @@
|
||||||
<!-- Leaflet Fullscreen -->
|
<!-- Leaflet Fullscreen -->
|
||||||
<script src="/js/leaflet-fullscreen/leaflet.fullscreen.min.js"></script>
|
<script src="/js/leaflet-fullscreen/leaflet.fullscreen.min.js"></script>
|
||||||
|
|
||||||
<script>
|
{{- partial "cv/locations/heatmap.js" ( dict "all_pages" $.Site.AllPages "locations" $.Site.Data.locations ) -}}
|
||||||
{{- partial "cv/locations/heatmap.js" ( dict "all_pages" $.Site.AllPages ) -}}
|
|
||||||
</script>
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ define "main-header" }}
|
{{ define "main-header" }}
|
||||||
|
@ -34,7 +39,10 @@
|
||||||
|
|
||||||
{{ define "main-body" }}
|
{{ define "main-body" }}
|
||||||
<article class="site-content__body site-content__body--chart">
|
<article class="site-content__body site-content__body--chart">
|
||||||
<div id="map" style="width: 100%; height: 500px; margin: 0; display: block;"></div>
|
<div
|
||||||
|
id="map"
|
||||||
|
style="width: 100%; height: 500px; margin: 0; display: block;"
|
||||||
|
></div>
|
||||||
|
|
||||||
{{- with ( partial "util/render_recursive_list.html" ( dict "sc" $ "pc" . "items" $.Site.Data.locations "schemaType" "Place" ) ) -}}
|
{{- with ( partial "util/render_recursive_list.html" ( dict "sc" $ "pc" . "items" $.Site.Data.locations "schemaType" "Place" ) ) -}}
|
||||||
<section style="grid-area: section-content">
|
<section style="grid-area: section-content">
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
/*
|
{{/*
|
||||||
Recursively render an ordered or unordered list from a set of arbitrarily-
|
Recursively render an ordered or unordered list from a set of arbitrarily-
|
||||||
deeply-nested items.
|
deeply-nested items.
|
||||||
|
|
||||||
@params all_pages All site pages
|
@params all_pages All site pages
|
||||||
*/
|
@params locations All locations
|
||||||
|
*/}}
|
||||||
|
|
||||||
|
<script>
|
||||||
var map = L.map('map', {
|
var map = L.map('map', {
|
||||||
fullscreenControl: true
|
fullscreenControl: true
|
||||||
}).setView([55, -3], 3);
|
}).setView([55, -3], 3);
|
||||||
|
@ -14,7 +16,7 @@ L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'
|
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'
|
||||||
}).addTo(map);
|
}).addTo(map);
|
||||||
|
|
||||||
{{- $locations := partialCached "util/get_location_leaf_nodes.html" $.Site.Data.locations -}}
|
{{- $locations := partialCached "util/get_location_leaf_nodes.html" .locations -}}
|
||||||
|
|
||||||
{{/*
|
{{/*
|
||||||
{{- range .Site.AllPages -}}
|
{{- range .Site.AllPages -}}
|
||||||
|
@ -45,3 +47,4 @@ L.heatLayer(
|
||||||
gradient: {0.1: 'blue', 0.3: 'lime', 0.8: 'orange', 1: 'red'}
|
gradient: {0.1: 'blue', 0.3: 'lime', 0.8: 'orange', 1: 'red'}
|
||||||
}
|
}
|
||||||
).addTo(map);
|
).addTo(map);
|
||||||
|
</script>
|
||||||
|
|
Loading…
Add table
Reference in a new issue