diff options
author | Christopher Baines <cbaines8@gmail.com> | 2013-02-15 10:54:22 +0000 |
---|---|---|
committer | Christopher Baines <cbaines8@gmail.com> | 2013-02-15 10:54:22 +0000 |
commit | 70ce303fc99cfaffa25141024c69c602ef89ede0 (patch) | |
tree | a29bbc142a085545d721cf4225898f29e361b023 | |
parent | af54d6f83f8d51f5528c53056ff41bbeaabf319d (diff) | |
download | health-map-70ce303fc99cfaffa25141024c69c602ef89ede0.tar health-map-70ce303fc99cfaffa25141024c69c602ef89ede0.tar.gz |
Add stuff to cope with health centers without catchment areas
-rw-r--r-- | resources/map.js | 11 |
1 files 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; }, |