Compare commits
2 Commits
82fa063b9d
...
99bea6ae6c
Author | SHA1 | Date | |
---|---|---|---|
|
99bea6ae6c | ||
|
8f7b53be73 |
@ -3,6 +3,4 @@ draft: false
|
|||||||
---
|
---
|
||||||
<h1>Lumbung of Publishers</h1>
|
<h1>Lumbung of Publishers</h1>
|
||||||
|
|
||||||
<article class="map">
|
{{< publishers_map >}}
|
||||||
{{< map geoJson="data/geojsonContributors.json">}}
|
|
||||||
</article>
|
|
55
themes/lumbung-theme/layouts/shortcodes/publishers_map.html
Normal file
55
themes/lumbung-theme/layouts/shortcodes/publishers_map.html
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.3/dist/leaflet.css"
|
||||||
|
integrity="sha256-kLaT2GOSpHechhsozzB+flnD+zUyjE2LlfWPgU04xyI=" crossorigin="" />
|
||||||
|
|
||||||
|
<script src="https://unpkg.com/leaflet@1.9.3/dist/leaflet.js"
|
||||||
|
integrity="sha256-WBkoXOwTeyKclOHuWtc+i2uENFpDZ9YPdf5Hf+D7ewM=" crossorigin=""></script>
|
||||||
|
|
||||||
|
<div id="map"></div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
#map {
|
||||||
|
width: 100%;
|
||||||
|
padding-bottom: 70%;
|
||||||
|
margin-bottom: 80px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var map = L.map('map').setView([51.505, -0.09], 3);
|
||||||
|
window.addEventListener('load', (event) => {
|
||||||
|
map.invalidateSize();
|
||||||
|
});
|
||||||
|
|
||||||
|
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||||
|
maxZoom: 19,
|
||||||
|
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
|
||||||
|
}).addTo(map);
|
||||||
|
|
||||||
|
|
||||||
|
{{ with getJSON "https://kios-admin.lumbung.space/api/dispatches"}}
|
||||||
|
{{ range .docs }}
|
||||||
|
var start = L.GeoJSON.coordsToLatLng({{ .startingPoint.location }});
|
||||||
|
var end = L.GeoJSON.coordsToLatLng({{ .endPoint.location }});
|
||||||
|
|
||||||
|
var startMarker = L.marker(start).addTo(map);
|
||||||
|
startMarker.bindPopup({{ .startingPoint.name }});
|
||||||
|
|
||||||
|
var endMarker = L.marker(end).addTo(map);
|
||||||
|
endMarker.bindPopup({{ .endPoint.name }});
|
||||||
|
|
||||||
|
var route = L.polyline([start, end], {color: '#000'}).addTo(map);
|
||||||
|
|
||||||
|
var productsString = "";
|
||||||
|
var productsList = {{ .products }};
|
||||||
|
productsList.forEach((product, i) => productsString = productsString + product.productTitle + (i + 1 < productsList.length ? ', ' : ""));
|
||||||
|
|
||||||
|
route.bindPopup(
|
||||||
|
'<p>Origin: <strong>' + {{ .startingPoint.name }} + '</strong><br />' +
|
||||||
|
'Destination: <strong>' + {{ .endPoint.name }} + '</strong><br />' +
|
||||||
|
'Courier: <strong>' + {{ .courier.name }} + '</strong><br />' +
|
||||||
|
'Products: <strong>' + productsString + '</strong><br />' +
|
||||||
|
'Status: <strong>' + {{ .status }} + '</strong></p>');
|
||||||
|
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
</script>
|
Loading…
Reference in New Issue
Block a user