0001-misc-reset-select-set-by-geolocation-on-unknown-valu.patch
wcs/qommon/static/js/qommon.geolocation.js | ||
---|---|---|
7 | 7 |
if ($options.length == 0) return; |
8 | 8 | |
9 | 9 |
var slugified_value = $.slugify(element_value); |
10 |
var prefilled = false; |
|
10 | 11 |
for (var i=0; i<$options.length; i++) { |
11 | 12 |
var $option = $($options[i]); |
12 | 13 |
if ($.slugify($option.val()) == slugified_value || |
13 | 14 |
$.slugify($option.text()) == slugified_value) { |
14 | 15 |
$option.prop('selected', true); |
15 | 16 |
$option.parent().trigger('change'); |
17 |
prefilled = true; |
|
16 | 18 |
break; |
17 | 19 |
} |
18 | 20 |
} |
21 |
if (!prefilled) { |
|
22 |
$($options[0]).prop('selected', true); |
|
23 |
$($options[0]).parent().trigger('change'); |
|
24 |
} |
|
19 | 25 |
} |
20 | 26 | |
21 | 27 |
$(document).on('set-geolocation', function(event, coords) { |
22 |
- |