From ae107a75f2a0211a8aeb082127865ff029ed87a5 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Wed, 17 Jun 2020 03:07:49 +0300 Subject: Add leaflet css and js libs --- bh20simplewebuploader/templates/demo.html | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'bh20simplewebuploader/templates/demo.html') diff --git a/bh20simplewebuploader/templates/demo.html b/bh20simplewebuploader/templates/demo.html index d9ebae2..b9df5dc 100644 --- a/bh20simplewebuploader/templates/demo.html +++ b/bh20simplewebuploader/templates/demo.html @@ -1,16 +1,19 @@ {% include 'header.html' %} + {% include 'banner.html' %} {% include 'menu.html' %} {% include 'search.html' %} {% include 'demo-run.html' %} - - WIP - {% include 'footer.html' %} + -- cgit v1.2.3 From 967e1d56a81c184d3dc8d265dec13852eb8c90a6 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Wed, 17 Jun 2020 03:13:53 +0300 Subject: Move leaflet CSS to the head section --- bh20simplewebuploader/templates/demo.html | 6 ------ bh20simplewebuploader/templates/header.html | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'bh20simplewebuploader/templates/demo.html') diff --git a/bh20simplewebuploader/templates/demo.html b/bh20simplewebuploader/templates/demo.html index b9df5dc..f3d2df5 100644 --- a/bh20simplewebuploader/templates/demo.html +++ b/bh20simplewebuploader/templates/demo.html @@ -1,9 +1,6 @@ {% include 'header.html' %} - {% include 'banner.html' %} {% include 'menu.html' %} @@ -11,9 +8,6 @@ {% include 'demo-run.html' %} {% include 'footer.html' %} - -- cgit v1.2.3 From 81230deb1ff6ec179cd84ecdeaf9ae891b256d55 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Wed, 17 Jun 2020 16:10:39 +0300 Subject: Move map logic to main.js --- bh20simplewebuploader/static/main.js | 13 +++++++++++++ bh20simplewebuploader/templates/demo.html | 2 -- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'bh20simplewebuploader/templates/demo.html') diff --git a/bh20simplewebuploader/static/main.js b/bh20simplewebuploader/static/main.js index 7361a99..0556fb7 100644 --- a/bh20simplewebuploader/static/main.js +++ b/bh20simplewebuploader/static/main.js @@ -13,14 +13,27 @@ function myFunction() { } } +let map = L.map( 'map', { + center: [37.0902, -95.7129], // Default to U.S.A + minZoom: 3, + zoom: 0 +}); +L.tileLayer( 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { + attribution: '© OpenStreetMap', + subdomains: ['a','b','c'] +}).addTo( map ); + function fetchAPI(apiEndPoint) { fetch(scriptRoot + apiEndPoint) .then(response => { return response.json(); }) .then(data => { + console.log(data); document.getElementById("results").classList.remove("invisible"); document.getElementById("loader").classList.add("invisible"); + // Reload the map + map.invalidateSize(); }); document.getElementById("results").classList.add("invisible"); document.getElementById("loader").classList.remove("invisible"); diff --git a/bh20simplewebuploader/templates/demo.html b/bh20simplewebuploader/templates/demo.html index f3d2df5..76c19c4 100644 --- a/bh20simplewebuploader/templates/demo.html +++ b/bh20simplewebuploader/templates/demo.html @@ -22,8 +22,6 @@ span.appendChild(txt); }); }); - - var mymap = L.map('mapid').setView([51.505, -0.09], 13); -- cgit v1.2.3