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" }}
|
||||
Locations | {{ .Site.Title }}
|
||||
Locations |
|
||||
{{ .Site.Title }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "main-class" }}--section location-map{{ end }}
|
||||
|
||||
{{ define "header-scripts" }}
|
||||
<!-- Leaflet -->
|
||||
<link rel="stylesheet" href="/css/leaflet/leaflet.css" />
|
||||
<link rel="stylesheet" href="/js/leaflet-fullscreen/leaflet.fullscreen.css" />
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="/css/leaflet/leaflet.css"
|
||||
/>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="/js/leaflet-fullscreen/leaflet.fullscreen.css"
|
||||
/>
|
||||
{{ end }}
|
||||
|
||||
{{ define "footer-scripts" }}
|
||||
|
@ -20,9 +27,7 @@
|
|||
<!-- Leaflet Fullscreen -->
|
||||
<script src="/js/leaflet-fullscreen/leaflet.fullscreen.min.js"></script>
|
||||
|
||||
<script>
|
||||
{{- partial "cv/locations/heatmap.js" ( dict "all_pages" $.Site.AllPages ) -}}
|
||||
</script>
|
||||
{{- partial "cv/locations/heatmap.js" ( dict "all_pages" $.Site.AllPages "locations" $.Site.Data.locations ) -}}
|
||||
{{ end }}
|
||||
|
||||
{{ define "main-header" }}
|
||||
|
@ -34,7 +39,10 @@
|
|||
|
||||
{{ define "main-body" }}
|
||||
<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" ) ) -}}
|
||||
<section style="grid-area: section-content">
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
/*
|
||||
{{/*
|
||||
Recursively render an ordered or unordered list from a set of arbitrarily-
|
||||
deeply-nested items.
|
||||
|
||||
@params all_pages All site pages
|
||||
*/
|
||||
@params locations All locations
|
||||
*/}}
|
||||
|
||||
<script>
|
||||
var map = L.map('map', {
|
||||
fullscreenControl: true
|
||||
}).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>'
|
||||
}).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 -}}
|
||||
|
@ -45,3 +47,4 @@ L.heatLayer(
|
|||
gradient: {0.1: 'blue', 0.3: 'lime', 0.8: 'orange', 1: 'red'}
|
||||
}
|
||||
).addTo(map);
|
||||
</script>
|
||||
|
|
Loading…
Add table
Reference in a new issue