summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhellekin <hellekin@cepheide.org>2018-04-03 11:33:51 +0200
committerhellekin <hellekin@cepheide.org>2018-04-03 11:33:51 +0200
commit0bd30846c2138cde2559f04afc8d869b2adcf99b (patch)
tree0eea2fbbc5c3c11f5f43cdc3ddaf6f8f6fcc3a8f
parent4f6c8ac616d3da59cfc087d8fb826b56280102d8 (diff)
downloadwallonie-demain-proto-0bd30846c2138cde2559f04afc8d869b2adcf99b.tar.gz
Ensure section is not clickable while no data is ready
-rw-r--r--assets/mapper.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/assets/mapper.js b/assets/mapper.js
index df3c8fe..46b203d 100644
--- a/assets/mapper.js
+++ b/assets/mapper.js
@@ -205,13 +205,15 @@ function listSections(sections) {
var li = $('<li>')
li.attr('id', 's-' + s.id)
li.html(s.name)
- li.mouseover(function(e) {
-// console.log('mouseover: fetching markers')
- var sec_id = $(this).attr('id').substr(2)
- fetchMarkers(sec_id)
- }).click(function(e) {
+ li.click(function(e) {
+ if ($.isEmptyObject(Markers[sec_id])) {
+ $(this).addClass('pending')
+ return false
+ }
+ $(this)
+ .removeClass('pending')
+ .toggleClass('active')
var sec_id = $(this).attr('id').substr(2)
- $(this).toggleClass('active')
toggleMarkers(sec_id)
return false
})