mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-24 00:54:03 +02:00
Merge branch 'master' into quick-translate
This commit is contained in:
+10
-11
@@ -58,19 +58,18 @@ export function uiCommit(context) {
|
||||
context.connection().userChangesets(function (err, changesets) {
|
||||
if (err) return;
|
||||
|
||||
var comments = [];
|
||||
|
||||
for (var i = 0; i < changesets.length; i++) {
|
||||
if (changesets[i].tags.comment) {
|
||||
comments.push({
|
||||
title: changesets[i].tags.comment,
|
||||
value: changesets[i].tags.comment
|
||||
});
|
||||
}
|
||||
}
|
||||
var comments = changesets.map(function(changeset) {
|
||||
return {
|
||||
title: changeset.tags.comment,
|
||||
value: changeset.tags.comment
|
||||
};
|
||||
});
|
||||
|
||||
commentField
|
||||
.call(d3combobox().caseSensitive(true).data(comments));
|
||||
.call(d3combobox()
|
||||
.caseSensitive(true)
|
||||
.data(_.uniqBy(comments, 'title'))
|
||||
);
|
||||
});
|
||||
|
||||
var clippyArea = commentSection.append('div')
|
||||
|
||||
@@ -16,20 +16,11 @@ import { utilGetSetValue } from '../../util/get_set_value';
|
||||
|
||||
export function uiFieldAddress(field, context) {
|
||||
var dispatch = d3.dispatch('init', 'change'),
|
||||
nominatim = services.nominatim,
|
||||
nominatim = services.geocoder,
|
||||
wrap = d3.select(null),
|
||||
isInitialized = false,
|
||||
entity;
|
||||
|
||||
var widths = {
|
||||
housenumber: 1/3,
|
||||
street: 2/3,
|
||||
city: 2/3,
|
||||
state: 1/4,
|
||||
postcode: 1/3
|
||||
};
|
||||
|
||||
|
||||
function getNearStreets() {
|
||||
var extent = entity.extent(context.graph()),
|
||||
l = extent.center(),
|
||||
@@ -98,7 +89,6 @@ export function uiFieldAddress(field, context) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function getNearValues(key) {
|
||||
var extent = entity.extent(context.graph()),
|
||||
l = extent.center(),
|
||||
@@ -130,6 +120,11 @@ export function uiFieldAddress(field, context) {
|
||||
return a && a.countryCodes && _.includes(a.countryCodes, countryCode);
|
||||
}) || _.first(dataAddressFormats);
|
||||
|
||||
var widths = addressFormat.widths || {
|
||||
housenumber: 1/3, street: 2/3,
|
||||
city: 2/3, state: 1/4, postcode: 1/3
|
||||
};
|
||||
|
||||
function row(r) {
|
||||
// Normalize widths.
|
||||
var total = _.reduce(r, function(sum, field) {
|
||||
@@ -154,19 +149,25 @@ export function uiFieldAddress(field, context) {
|
||||
.enter()
|
||||
.append('input')
|
||||
.property('type', 'text')
|
||||
.attr('placeholder', function (d) { return field.t('placeholders.' + d.id); })
|
||||
.attr('placeholder', function (d) {
|
||||
var localkey = d.id + '!' + countryCode,
|
||||
tkey = field.strings.placeholders[localkey] ? localkey : d.id;
|
||||
return field.t('placeholders.' + tkey);
|
||||
})
|
||||
.attr('class', function (d) { return 'addr-' + d.id; })
|
||||
.style('width', function (d) { return d.width * 100 + '%'; });
|
||||
|
||||
// Update
|
||||
var addrTags = [
|
||||
|
||||
// setup dropdowns for common address tags
|
||||
var dropdowns = addressFormat.dropdowns || [
|
||||
'city', 'county', 'country', 'district', 'hamlet',
|
||||
'neighbourhood', 'place', 'postcode', 'province',
|
||||
'quarter', 'state', 'street', 'subdistrict', 'suburb'
|
||||
];
|
||||
|
||||
// If fields exist for any of these tags, create dropdowns to pick nearby values..
|
||||
addrTags.forEach(function(tag) {
|
||||
dropdowns.forEach(function(tag) {
|
||||
var nearValues = (tag === 'street') ? getNearStreets
|
||||
: (tag === 'city') ? getNearCities
|
||||
: getNearValues;
|
||||
@@ -202,7 +203,6 @@ export function uiFieldAddress(field, context) {
|
||||
.attr('class', 'preset-input-wrap')
|
||||
.merge(wrap);
|
||||
|
||||
|
||||
if (nominatim && entity) {
|
||||
var center = entity.extent(context.graph()).center();
|
||||
nominatim.countryCode(center, initCallback);
|
||||
|
||||
@@ -15,7 +15,7 @@ export {
|
||||
|
||||
export function uiFieldCombo(field, context) {
|
||||
var dispatch = d3.dispatch('change'),
|
||||
nominatim = services.nominatim,
|
||||
nominatim = services.geocoder,
|
||||
taginfo = services.taginfo,
|
||||
isMulti = (field.type === 'multiCombo'),
|
||||
isNetwork = (field.type === 'networkCombo'),
|
||||
|
||||
@@ -15,7 +15,7 @@ export {
|
||||
|
||||
export function uiFieldText(field, context) {
|
||||
var dispatch = d3.dispatch('change'),
|
||||
nominatim = services.nominatim,
|
||||
nominatim = services.geocoder,
|
||||
input,
|
||||
entity;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
export { uiInit } from './init';
|
||||
export { uiFields } from './fields/index';
|
||||
export { uiAccount } from './account';
|
||||
export { uiAttribution } from './attribution';
|
||||
export { uiBackground } from './background';
|
||||
@@ -18,7 +17,6 @@ export { uiGeolocate } from './geolocate';
|
||||
export { uiHelp } from './help';
|
||||
export { uiInfo } from './info';
|
||||
export { uiInspector } from './inspector';
|
||||
export { uiIntro } from './intro';
|
||||
export { uiLasso } from './lasso';
|
||||
export { uiLoading } from './loading';
|
||||
export { uiMapData } from './map_data';
|
||||
|
||||
Reference in New Issue
Block a user