Skip to content

Commit

Permalink
Merge pull request #30 from OnroerendErfgoed/develop
Browse files Browse the repository at this point in the history
release 1.2.0
  • Loading branch information
cedrikv authored Aug 26, 2021
2 parents 6779835 + 230cdc3 commit 2d7f6a4
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 5 deletions.
40 changes: 36 additions & 4 deletions CrabZoomer.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,16 +337,21 @@ define([
_setValueAttr: function (location) {
//console.debug('CrabZoomer::_setValueAttr', location);
this.value = location;

// Andere logica voor Brussel omdat er legacy code in de _setRegion zit die pas na een call opnieuw gemeentes inlaadt.
if (location.region && location.region.id === '1') {
domUtils.setSelectedOptions(this.gewestSelect, ['1']);
this._gewestChangeWithNoProvince();
this._setMunicipality(location.municipality.id);
return;
}

if (this.alleGewesten) {
this._setRegion(location.region ? location.region.id : '');
}
if (location.province) {
this._setProvince(location.province.id);
}
else if (location.municipality) {
this._setMunicipality(location.municipality.id);

}
},

getBbox: function () {
Expand Down Expand Up @@ -500,6 +505,33 @@ define([
this._errorHandler(error);
})
);
},

_gewestChangeWithNoProvince: function () {
var value = domUtils.getSelectedOption(this.gewestSelect);

this.disable();
this._fillStreetSelect([]);
this._fillNumberSelect([]);

if (!value) {
this.provinceList = this.provinceCache.sort(this.sortMethod);
this._fillProvinceSelect(this.provinceCache);
this._fillMunicipalitySelect(this.municipalityCache);
domAttr.remove(this.gewestSelect, 'disabled');
domAttr.remove(this.provinceSelect, 'disabled');
domAttr.remove(this.municipalitySelect, 'disabled');
return false;
}

this.provinceList = array.filter(this.provinceCache, function (item){
return item.gewest.id === parseInt(value);
});
this._fillProvinceSelect(this.provinceList);
domAttr.remove(this.gewestSelect, 'disabled');
if (this.provinceList.length > 0){
domAttr.remove(this.provinceSelect, 'disabled');
}
}
});
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "crabpy_dojo",
"description": "A lightweight widget designed for crabpy_pyramid",
"keywords": ["JavaScript", "Dojo", "Widget", "crabpy"],
"version": "1.1.2",
"version": "1.2.0",
"repository": {
"type":"git",
"url":"https://github.com/OnroerendErfgoed/crabpy_dojo"
Expand Down

0 comments on commit 2d7f6a4

Please sign in to comment.