From 4f5fe0db0e3d1cc2c4c7c8360b7bd3a02e88dbb3 Mon Sep 17 00:00:00 2001 From: Dan Harrin Date: Tue, 9 Jul 2019 22:52:22 +0100 Subject: [PATCH] Implement UK County Support (#72) Credit to @DanHarrin --- .../assets/js/location-autocomplete.js | 14 ++++++++++---- updates/version.yaml | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/formwidgets/addressfinder/assets/js/location-autocomplete.js b/formwidgets/addressfinder/assets/js/location-autocomplete.js index bce2bd7..825a354 100644 --- a/formwidgets/addressfinder/assets/js/location-autocomplete.js +++ b/formwidgets/addressfinder/assets/js/location-autocomplete.js @@ -5,8 +5,9 @@ * - data-control="location-autocomplete" - enables the plugin on an element * - data-input-street="#locationStreet" - input to populate with street * - data-input-city="#locationCity" - input to populate with city - * - data-input-zip="#locationZip" - input to populate with zip + * - data-input-county="#locationCounty" - input to populate with county * - data-input-state="#locationState" - input to populate with state + * - data-input-zip="#locationZip" - input to populate with zip * - data-input-country="#locationCountry" - input to populate with country * - data-input-country-long="#locationCountry" - input to populate with country (long name) * - data-input-latitude="#locationLatitude" - input to populate with latitude @@ -27,6 +28,7 @@ data-country-restriction="us,ch" data-input-street="#inputStreet" data-input-city="#locationCity" + data-input-county="#locationCounty" data-input-state="#locationState" data-input-zip="#locationZip" data-input-country="#locationCountry" @@ -34,6 +36,7 @@ + @@ -59,8 +62,9 @@ inputLongitude: null, inputStreet: null, inputCity: null, - inputZip: null, + inputCounty: null, inputState: null, + inputZip: null, inputVicinity: null, inputCountry: null, inputCountryLong: null @@ -98,8 +102,9 @@ 'short': { inputStreet: ['street_number', 'route'], inputCity: ['locality', 'postal_town'], - inputZip: 'postal_code', + inputCounty: 'administrative_area_level_2', inputState: 'administrative_area_level_1', + inputZip: 'postal_code', inputCountry: 'country' }, 'long': { @@ -184,9 +189,10 @@ * street_number = Street Number * route = Street * locality = City + * administrative_area_level_2 = County * administrative_area_level_1 = State - * country = Country * postal_code = Zip + * country = Country * */ LocationAutocomplete.prototype.getValueFromAddressObject = function(addressObj, type, resultType) { diff --git a/updates/version.yaml b/updates/version.yaml index be740e8..40686c1 100644 --- a/updates/version.yaml +++ b/updates/version.yaml @@ -19,3 +19,4 @@ 1.1.3: - Include Argentina states - seed_ar_states.php +1.1.4: Added support for UK counties