From c1e876228787a4f31dfe5f706572c0c43ca42355 Mon Sep 17 00:00:00 2001 From: Carl van Tonder Date: Mon, 18 Jun 2018 15:28:16 -0400 Subject: [PATCH] Avoid JS map crash on missing images --- apps/map/templates/map/index.html | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/apps/map/templates/map/index.html b/apps/map/templates/map/index.html index 0702284..340f15e 100644 --- a/apps/map/templates/map/index.html +++ b/apps/map/templates/map/index.html @@ -144,18 +144,20 @@ function getLabelClass(pos_or_neg) { } function popup(feature, layer) { - layer.bindPopup( - ""+ - ""+ - ""+ - "{% trans "View full case study" %}" - ); + var str = ''; + if(feature.properties.images.length > 0) { + str = ""; + } + str += (""+ + ""+ + "{% trans "View full case study" %}") + layer.bindPopup(str); }; // This is called when the map is initialized