Skip to content

Commit

Permalink
Implement UK County Support (#72)
Browse files Browse the repository at this point in the history
Credit to @danharrin
  • Loading branch information
danharrin authored and Luke Towers committed Jul 9, 2019
1 parent d7c08d4 commit 4f5fe0d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
14 changes: 10 additions & 4 deletions formwidgets/addressfinder/assets/js/location-autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -27,13 +28,15 @@
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"
/>
<input type="text" name="street" value="" id="inputStreet" />
<input type="text" name="city" value="" id="locationCity" />
<input type="text" name="county" value="" id="locationCounty" />
<input type="text" name="state" value="" id="locationState" />
<input type="text" name="zip" value="" id="locationZip" />
<input type="text" name="country" value="" id="locationCountry" />
Expand All @@ -59,8 +62,9 @@
inputLongitude: null,
inputStreet: null,
inputCity: null,
inputZip: null,
inputCounty: null,
inputState: null,
inputZip: null,
inputVicinity: null,
inputCountry: null,
inputCountryLong: null
Expand Down Expand Up @@ -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': {
Expand Down Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions updates/version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@
1.1.3:
- Include Argentina states
- seed_ar_states.php
1.1.4: Added support for UK counties

0 comments on commit 4f5fe0d

Please sign in to comment.