From 3e5f41f29f49c1c3f1f4b3af60507aff5ceb9efc Mon Sep 17 00:00:00 2001 From: Tom Russell Date: Fri, 3 Aug 2018 10:15:14 +0100 Subject: [PATCH] Preview building data --- frontend/main.css | 4 +++- frontend/main.js | 10 +++++++++- frontend/maps.html | 7 ++++--- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/frontend/main.css b/frontend/main.css index 396b1741..ca5d49e9 100755 --- a/frontend/main.css +++ b/frontend/main.css @@ -29,7 +29,9 @@ body { p { font-size: 1.1rem; } - +pre { + white-space: pre-wrap; +} /** * Main Layout */ diff --git a/frontend/main.js b/frontend/main.js index aecd77bb..ab34a262 100755 --- a/frontend/main.js +++ b/frontend/main.js @@ -68,13 +68,21 @@ function map(){ }).then(function(data){ if (data.geometry_id){ highlight_layer.setUrl('/tiles/highlight/{z}/{x}/{y}.png?highlight='+data.geometry_id) + } else { + map.removeLayer(highlight_layer) + highlight_layer_added = false } if (!highlight_layer_added && data.geometry_id){ highlight_layer.addTo(map); } + var preview_el = document.getElementById('building-detail'); + if (data.error){ + preview_el.textContent = 'Click a building to see data'; + } else { + preview_el.textContent = JSON.stringify(data, ["id", "date_year", "date_source", "uprns"], 2); + } }) }) - } /** diff --git a/frontend/maps.html b/frontend/maps.html index b9cb3dd5..62905690 100755 --- a/frontend/maps.html +++ b/frontend/maps.html @@ -60,10 +60,11 @@

View Maps

- (Mock) View building detail +

Building

+
+Click a building to see data.
+