0001-js-wait-a-bit-for-geocoding-before-going-on-with-for.patch
wcs/qommon/static/js/qommon.forms.js | ||
---|---|---|
262 | 262 |
* the same page; enable it back after a few seconds. */ |
263 | 263 |
setTimeout(function() { $form.removeClass('disabled-during-submit'); }, 3000); |
264 | 264 |
} |
265 |
if ($form[0].wait_for_changes) { |
|
266 |
var waited = 0; |
|
267 |
var $button = $(event.originalEvent.submitter); |
|
268 |
if (! $button.is('button')) { |
|
269 |
$button = $('form .buttons .submit-button button'); |
|
270 |
} |
|
271 |
var wait_id = setInterval(function() { |
|
272 |
waited += 1; |
|
273 |
if (! $form[0].wait_for_changes) { |
|
274 |
clearInterval(wait_id); |
|
275 |
$button.click(); |
|
276 |
return; |
|
277 |
} else if (waited > 5) { |
|
278 |
$form[0].wait_for_changes = false; |
|
279 |
} |
|
280 |
}, 200); |
|
281 |
return false; |
|
282 |
} |
|
265 | 283 |
return true; |
266 | 284 |
}); |
267 | 285 |
var live_evaluation = null; |
wcs/qommon/static/js/qommon.geolocation.js | ||
---|---|---|
119 | 119 | |
120 | 120 |
function set_sync_callback() { |
121 | 121 |
var $map = $('.qommon-map'); |
122 |
if ($map.length == 0) return; |
|
123 |
var $form = $map.parents('form'); |
|
124 |
$form[0].wait_for_changes = false; |
|
122 | 125 |
if (! $map.data('address-sync')) return; |
123 | 126 |
$('div[data-geolocation]').on('change', 'input[type=text], textarea, select', function(event) { |
127 |
$form[0].wait_for_changes = true; |
|
124 | 128 |
var address = ''; |
125 | 129 |
var found_city = false; |
126 | 130 |
$(['number-and-street', 'house', 'road', 'postcode', 'city', 'country']).each(function(idx, elem) { |
... | ... | |
146 | 150 |
map.marker.addTo(map); |
147 | 151 |
} |
148 | 152 |
$map.trigger('set-geolocation', coords, {'trigger': false}); |
153 |
$form[0].wait_for_changes = false; |
|
149 | 154 |
} |
150 | 155 |
}); |
151 | 156 |
} |
152 |
- |