diff --git a/css/80_app.css b/css/80_app.css index bc1778718..cf2227bd3 100644 --- a/css/80_app.css +++ b/css/80_app.css @@ -4529,13 +4529,8 @@ img.tile-debug { height: 14px; margin-top: -2px; } -.ideditor[dir='ltr'] .map-footer-list a.chip .icon, -.ideditor[dir='ltr'] .map-footer-list a.chip span { - margin-right: 3px; -} -.ideditor[dir='rtl'] .map-footer-list a.chip .icon, -.ideditor[dir='rtl'] .map-footer-list a.chip span { - margin-left: 3px; +.map-footer-list a.chip span.count { + margin: 0 3px; } .source-switch a.chip.live { diff --git a/modules/renderer/background_source.js b/modules/renderer/background_source.js index b3bf00701..d0dc312bb 100644 --- a/modules/renderer/background_source.js +++ b/modules/renderer/background_source.js @@ -72,6 +72,12 @@ export function rendererBackgroundSource(data) { }; + source.label = function() { + var id_safe = source.id.replace(/\./g, ''); + return t.html('imagery.' + id_safe + '.name', { default: _name }); + }; + + source.description = function() { var id_safe = source.id.replace(/\./g, ''); return t('imagery.' + id_safe + '.description', { default: _description }); @@ -538,6 +544,11 @@ rendererBackgroundSource.None = function() { }; + source.label = function() { + return t.html('background.none'); + }; + + source.imageryUsed = function() { return null; }; @@ -560,6 +571,10 @@ rendererBackgroundSource.Custom = function(template) { return t('background.custom'); }; + source.label = function() { + return t.html('background.custom'); + }; + source.imageryUsed = function() { // sanitize personal connection tokens - #6801 diff --git a/modules/ui/combobox.js b/modules/ui/combobox.js index 31bf215c4..e60d2af6e 100644 --- a/modules/ui/combobox.js +++ b/modules/ui/combobox.js @@ -6,8 +6,10 @@ import { utilGetSetValue, utilRebind, utilTriggerEvent } from '../util'; // This code assumes that the combobox values will not have duplicate entries. // It is keyed on the `value` of the entry. Data should be an array of objects like: // [{ -// value: 'display text', // required -// title: 'hover text' // optional +// value: 'string value', // required +// display: 'label html' // optional +// title: 'hover text' // optional +// terms: ['search terms'] // optional // }, ...] var _comboHideTimerID; diff --git a/modules/ui/fields/check.js b/modules/ui/fields/check.js index e5c305d36..8b7c80ceb 100644 --- a/modules/ui/fields/check.js +++ b/modules/ui/fields/check.js @@ -36,14 +36,14 @@ export function uiFieldCheck(field, context) { if (options) { for (var k in options) { values.push(k === 'undefined' ? undefined : k); - texts.push(field.t('options.' + k, { 'default': options[k] })); + texts.push(field.t.html('options.' + k, { 'default': options[k] })); } } else { values = [undefined, 'yes']; - texts = [t('inspector.unknown'), t('inspector.check.yes')]; + texts = [t.html('inspector.unknown'), t.html('inspector.check.yes')]; if (field.type !== 'defaultCheck') { values.push('no'); - texts.push(t('inspector.check.no')); + texts.push(t.html('inspector.check.no')); } } @@ -59,7 +59,7 @@ export function uiFieldCheck(field, context) { for (var key in entity.tags) { if (key in osmOneWayTags && (entity.tags[key] in osmOneWayTags[key])) { _impliedYes = true; - texts[0] = t('presets.fields.oneway_yes.options.undefined'); + texts[0] = t.html('presets.fields.oneway_yes.options.undefined'); break; } } diff --git a/modules/ui/fields/combo.js b/modules/ui/fields/combo.js index 6bc7400a3..69b42965d 100644 --- a/modules/ui/fields/combo.js +++ b/modules/ui/fields/combo.js @@ -151,7 +151,8 @@ export function uiFieldCombo(field, context) { return { key: k, value: v, - title: v + title: v, + display: field.t.html('options.' + k, { 'default': _optstrings[k] }) }; }); diff --git a/modules/ui/form_fields.js b/modules/ui/form_fields.js index 3ee8fa5cd..365a97457 100644 --- a/modules/ui/form_fields.js +++ b/modules/ui/form_fields.js @@ -60,8 +60,9 @@ export function uiFormFields(context) { if (field.keys) terms = terms.concat(field.keys); return { - title: title, + display: field.label(), value: title, + title: title, field: field, terms: terms }; diff --git a/modules/ui/info.js b/modules/ui/info.js index 882930ed6..5f86a6567 100644 --- a/modules/ui/info.js +++ b/modules/ui/info.js @@ -59,7 +59,7 @@ export function uiInfo(context) { title .append('h3') - .html(function(d) { return panels[d].title; }); + .html(function(d) { return panels[d].label; }); title .append('button') diff --git a/modules/ui/panels/background.js b/modules/ui/panels/background.js index e8ae44074..7dfd8a21b 100644 --- a/modules/ui/panels/background.js +++ b/modules/ui/panels/background.js @@ -9,9 +9,9 @@ import { t } from '../../core/localizer'; export function uiPanelBackground(context) { var background = context.background(); - var currSourceName = null; - var metadata = {}; - var metadataKeys = [ + var _currSourceName = null; + var _metadata = {}; + var _metadataKeys = [ 'zoom', 'vintage', 'source', 'description', 'resolution', 'accuracy' ]; @@ -23,9 +23,10 @@ export function uiPanelBackground(context) { var isDG = (source.id.match(/^DigitalGlobe/i) !== null); - if (currSourceName !== source.name()) { - currSourceName = source.name(); - metadata = {}; + var sourceLabel = source.label(); + if (_currSourceName !== sourceLabel) { + _currSourceName = sourceLabel; + _metadata = {}; } selection.html(''); @@ -36,20 +37,20 @@ export function uiPanelBackground(context) { list .append('li') - .html(currSourceName); + .html(_currSourceName); - metadataKeys.forEach(function(k) { + _metadataKeys.forEach(function(k) { // DigitalGlobe vintage is available in raster layers for now. if (isDG && k === 'vintage') return; list .append('li') .attr('class', 'background-info-list-' + k) - .classed('hide', !metadata[k]) + .classed('hide', !_metadata[k]) .html(t.html('info_panels.background.' + k) + ':') .append('span') .attr('class', 'background-info-span-' + k) - .html(metadata[k]); + .html(_metadata[k]); }); debouncedGetMetadata(selection); @@ -103,36 +104,36 @@ export function uiPanelBackground(context) { var tile = context.container().select('.layer-background img.tile-center'); // tile near viewport center if (tile.empty()) return; - var sourceName = currSourceName; + var sourceName = _currSourceName; var d = tile.datum(); var zoom = (d && d.length >= 3 && d[2]) || Math.floor(context.map().zoom()); var center = context.map().center(); // update zoom - metadata.zoom = String(zoom); + _metadata.zoom = String(zoom); selection.selectAll('.background-info-list-zoom') .classed('hide', false) .selectAll('.background-info-span-zoom') - .html(metadata.zoom); + .html(_metadata.zoom); if (!d || !d.length >= 3) return; background.baseLayerSource().getMetadata(center, d, function(err, result) { - if (err || currSourceName !== sourceName) return; + if (err || _currSourceName !== sourceName) return; // update vintage var vintage = result.vintage; - metadata.vintage = (vintage && vintage.range) || t('info_panels.background.unknown'); + _metadata.vintage = (vintage && vintage.range) || t('info_panels.background.unknown'); selection.selectAll('.background-info-list-vintage') .classed('hide', false) .selectAll('.background-info-span-vintage') - .html(metadata.vintage); + .html(_metadata.vintage); - // update other metadata - metadataKeys.forEach(function(k) { + // update other _metadata + _metadataKeys.forEach(function(k) { if (k === 'zoom' || k === 'vintage') return; // done already var val = result[k]; - metadata[k] = val; + _metadata[k] = val; selection.selectAll('.background-info-list-' + k) .classed('hide', !val) .selectAll('.background-info-span-' + k) @@ -162,7 +163,7 @@ export function uiPanelBackground(context) { }; panel.id = 'background'; - panel.title = t('info_panels.background.title'); + panel.label = t.html('info_panels.background.title'); panel.key = t('info_panels.background.key'); diff --git a/modules/ui/panels/history.js b/modules/ui/panels/history.js index d477640a9..1329a04b8 100644 --- a/modules/ui/panels/history.js +++ b/modules/ui/panels/history.js @@ -249,7 +249,7 @@ export function uiPanelHistory(context) { }; panel.id = 'history'; - panel.title = t('info_panels.history.title'); + panel.label = t.html('info_panels.history.title'); panel.key = t('info_panels.history.key'); diff --git a/modules/ui/panels/location.js b/modules/ui/panels/location.js index 119c70c58..a40017a59 100644 --- a/modules/ui/panels/location.js +++ b/modules/ui/panels/location.js @@ -68,7 +68,7 @@ export function uiPanelLocation(context) { }; panel.id = 'location'; - panel.title = t('info_panels.location.title'); + panel.label = t.html('info_panels.location.title'); panel.key = t('info_panels.location.key'); diff --git a/modules/ui/panels/measurement.js b/modules/ui/panels/measurement.js index cd5333c3c..2737786ce 100644 --- a/modules/ui/panels/measurement.js +++ b/modules/ui/panels/measurement.js @@ -217,7 +217,7 @@ export function uiPanelMeasurement(context) { }; panel.id = 'measurement'; - panel.title = t('info_panels.measurement.title'); + panel.label = t.html('info_panels.measurement.title'); panel.key = t('info_panels.measurement.key'); diff --git a/modules/ui/sections/background_list.js b/modules/ui/sections/background_list.js index c9ecc432c..998020920 100644 --- a/modules/ui/sections/background_list.js +++ b/modules/ui/sections/background_list.js @@ -199,7 +199,7 @@ export function uiSectionBackgroundList(context) { label .append('span') - .html(function(d) { return d.name(); }); + .html(function(d) { return d.label(); }); enter.filter(function(d) { return d.id === 'custom'; }) .append('button') diff --git a/modules/ui/sections/overlay_list.js b/modules/ui/sections/overlay_list.js index cf59fe9e8..f4fa89063 100644 --- a/modules/ui/sections/overlay_list.js +++ b/modules/ui/sections/overlay_list.js @@ -81,7 +81,7 @@ export function uiSectionOverlayList(context) { label .append('span') - .html(function(d) { return d.name(); }); + .html(function(d) { return d.label(); }); layerList.selectAll('li') diff --git a/modules/ui/sections/photo_overlays.js b/modules/ui/sections/photo_overlays.js index 49aefe400..eb55e59c4 100644 --- a/modules/ui/sections/photo_overlays.js +++ b/modules/ui/sections/photo_overlays.js @@ -89,7 +89,7 @@ export function uiSectionPhotoOverlays(context) { .html(function(d) { var id = d.id; if (id === 'mapillary-signs') id = 'photo_overlays.traffic_signs'; - return t(id.replace(/-/g, '_') + '.title'); + return t.html(id.replace(/-/g, '_') + '.title'); }); diff --git a/modules/ui/sections/validation_rules.js b/modules/ui/sections/validation_rules.js index 9e7e892a8..ef0e9f561 100644 --- a/modules/ui/sections/validation_rules.js +++ b/modules/ui/sections/validation_rules.js @@ -105,7 +105,7 @@ export function uiSectionValidationRules(context) { if (d === 'unsquare_way') { params.val = ''; } - return t('issues.' + d + '.title', params); + return t.html('issues.' + d + '.title', params); }); // Update