add postal code field, fixes #1292

This commit is contained in:
Ansis Brammanis
2013-04-18 16:45:48 -04:00
parent 5ed5968b76
commit e893f686ca
6 changed files with 34 additions and 10 deletions

View File

@@ -1302,7 +1302,7 @@ input[type=number] {
}
.form-field .addr-number {
width: 20%;
width: 33%;
border-left: 0;
border-right: 0;
border-bottom: 0;
@@ -1310,19 +1310,26 @@ input[type=number] {
}
.form-field .addr-street {
width: 80%;
width: 66%;
border-right: 0;
border-bottom: 0;
border-radius: 0;
}
.form-field .addr-city {
width: 66%;
border-left: 0;
border-right: 0;
border-bottom: 0;
border-radius: 0 0 4px 4px;
border-radius: 0 0 0 4px;
}
.form-field .addr-postcode {
width: 33%;
border-right: 0;
border-bottom: 0;
border-radius: 0 0 4px 0;
}
/* combobox dropdown */
div.combobox {

View File

@@ -375,7 +375,8 @@ locale.en = {
"housename": "Housename",
"number": "123",
"street": "Street",
"city": "City"
"city": "City",
"postcode": "Postal code"
}
},
"admin_level": {

View File

@@ -46,6 +46,7 @@ en:
number: "123"
street: Street
city: City
postcode: Postal code
admin_level:
label: Admin Level
aeroway:

View File

@@ -51,7 +51,8 @@
"addr:housename",
"addr:housenumber",
"addr:street",
"addr:city"
"addr:city",
"addr:postcode"
],
"icon": "address",
"universal": true,
@@ -61,7 +62,8 @@
"housename": "Housename",
"number": "123",
"street": "Street",
"city": "City"
"city": "City",
"postcode": "Postal code"
}
}
},

View File

@@ -4,7 +4,8 @@
"addr:housename",
"addr:housenumber",
"addr:street",
"addr:city"
"addr:city",
"addr:postcode"
],
"icon": "address",
"universal": true,
@@ -14,7 +15,8 @@
"housename": "Housename",
"number": "123",
"street": "Street",
"city": "City"
"city": "City",
"postcode": "Postal code"
}
}
}
}

View File

@@ -5,6 +5,7 @@ iD.ui.preset.address = function(field, context) {
housenumber,
street,
city,
postcode,
entity;
function getStreets() {
@@ -76,6 +77,14 @@ iD.ui.preset.address = function(field, context) {
.on('blur', change)
.on('change', change)
.call(close());
postcode = wrap.append('input')
.property('type', 'text')
.attr('placeholder', field.t('placeholders.postcode'))
.attr('class', 'addr-postcode')
.on('blur', change)
.on('change', change)
.call(close());
}
function change() {
@@ -83,7 +92,8 @@ iD.ui.preset.address = function(field, context) {
'addr:housename': housename.property('value'),
'addr:housenumber': housenumber.property('value'),
'addr:street': street.property('value'),
'addr:city': city.property('value')
'addr:city': city.property('value'),
'addr:postcode': postcode.property('value')
});
}
@@ -98,6 +108,7 @@ iD.ui.preset.address = function(field, context) {
housenumber.property('value', tags['addr:housenumber'] || '');
street.property('value', tags['addr:street'] || '');
city.property('value', tags['addr:city'] || '');
postcode.property('value', tags['addr:postcode'] || '');
return address;
};