Skip to content

Commit

Permalink
restore RS
Browse files Browse the repository at this point in the history
  • Loading branch information
theKashey committed Oct 11, 2017
1 parent 0def8e6 commit 770c689
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 48 deletions.
86 changes: 43 additions & 43 deletions examples/react.countrySelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,53 +8,53 @@ import listOfCountries from 'iso3166-2-db/i18n/dispute/UN/en';
*/

class AddressSelector extends PureComponent {
state = {};
state = {};

onCountryChange = (event) => this.setState({
selectedCountry: event.target.value
});
onCountryChange = (event) => this.setState({
selectedCountry: event.target.value
});

onRegionChange = (event) => this.setState({
selectedRegion: event.target.value
});
onRegionChange = (event) => this.setState({
selectedRegion: event.target.value
});

// render list of countries
renderCountrySelector() {
return (
<select onChange={this.onCountryChange}>
{
Object.keys(listOfCountries).map(isoCode =>
<option key={isoCode} value={isoCode}>{listOfCountries[isoCode].name}</option>
)
}
</select>
)
}

// render list of states for selected country
renderStateSelector() {
const {selectedCountry} = this.state;
if (!selectedCountry) {
return null;
// render list of countries
renderCountrySelector() {
return (
<select onChange={this.onCountryChange}>
{
Object.keys(listOfCountries).map(isoCode =>
<option key={isoCode} value={isoCode}>{listOfCountries[isoCode].name}</option>
)
}
const regions = listOfCountries[selectedCountry].regions;
return (
<select onChange={this.onRegionChange}>
{
regions.map(region =>
<option key={region.iso} value={region.iso}>{region.name}</option>
)
}
</select>
)
}
</select>
)
}

render() {
return (
<div>
{ this.renderCountrySelector() }
{ this.renderStateSelector() }
</div>
)
// render list of states for selected country
renderStateSelector() {
const {selectedCountry} = this.state;
if (!selectedCountry) {
return null;
}
const regions = listOfCountries[selectedCountry].regions;
return (
<select onChange={this.onRegionChange}>
{
regions.map(region =>
<option key={region.iso} value={region.iso}>{region.name}</option>
)
}
</select>
)
}

render() {
return (
<div>
{ this.renderCountrySelector() }
{ this.renderStateSelector() }
</div>
)
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iso3166-2-db",
"version": "2.1.2",
"version": "2.1.3",
"description": "Provides information about countries and states of the world.",
"main": "lib/iso3166.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/disputes/EN.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ export default {
1152720: (region) => false,//drop Ab
1152717: (region) => false,//drop Oset

1741311: (region) => region.hasParent(1741311) && region.level == 6,//RS w/o RS-KM
1741311: (region) => region.hasParent(1741311) && region.level == 4,//RS w/o RS-KM
}
}
2 changes: 1 addition & 1 deletion src/disputes/RU.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default {
3263728: (region) => false, //drop Cirpus
3263726: (region) => false, //drop Cirpus

2088990: (region) => false //drop Serbia
2088990: (region) => false //drop Kosovo
},
fixtures: {
72639: {
Expand Down
2 changes: 1 addition & 1 deletion src/disputes/TR.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
export default {
rules: {
307787: (region) => false, //drop BIG Cirpus
1741311: (region) => region.hasParent(1741311) && region.level == 6,//RS w/o RS-KM
1741311: (region) => region.hasParent(1741311) && region.level == 4,//RS w/o RS-KM

1152720: (region) => false,//drop Ab
1152717: (region) => false,//drop Oset
Expand Down
2 changes: 1 addition & 1 deletion src/disputes/UA.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
3263728: (region) => false, //drop Cirpus
3263726: (region) => false, //drop Cirpus

2088990: (region) => false,//drop Serbia
2088990: (region) => false,//drop Kosovo

192691: (region) => region.hasParent(192691) || region.osmId == 195838, //move EH to MA
195838: (region) => false, //drop EH
Expand Down

0 comments on commit 770c689

Please sign in to comment.