From 70ce303fc99cfaffa25141024c69c602ef89ede0 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Fri, 15 Feb 2013 10:54:22 +0000 Subject: Add stuff to cope with health centers without catchment areas --- resources/map.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/resources/map.js b/resources/map.js index 17cf48d..64484f3 100644 --- a/resources/map.js +++ b/resources/map.js @@ -245,9 +245,14 @@ function initMap(self) { var healthPostProperties = fillObjectWithUnknowns(feature.properties, ["name", "emergency"]); - layer.bindPopup(self.editorTemplate({coordinate: center}) + - self.healthPostTemplate(healthPostProperties) + - self.catchmentAreaTemplate(catchmentAreaProperties(catchmentArea, feature))); + if (_.isUndefined(catchmentArea)) { + layer.bindPopup(self.editorTemplate({coordinate: center}) + + self.healthPostTemplate(healthPostProperties) + " No catchment Area"); + } else { + layer.bindPopup(self.editorTemplate({coordinate: center}) + + self.healthPostTemplate(healthPostProperties) + + self.catchmentAreaTemplate(catchmentAreaProperties(catchmentArea, feature))); + } self.markers[feature.id] = layer; }, -- cgit v1.2.3