change label of ui fields from raw html to a callback function

fixes #9159
This commit is contained in:
Martin Raifer
2022-06-23 10:29:22 +02:00
parent edf711ca2b
commit 9576e95d83
5 changed files with 13 additions and 11 deletions
+3 -1
View File
@@ -26,7 +26,9 @@ export function presetField(fieldID, field) {
_this.hasTextForStringId = (scope) => localizer.hasTextForStringId(`_tagging.presets.fields.${fieldID}.${scope}`);
_this.title = () => _this.overrideLabel || _this.t('label', { 'default': fieldID });
_this.label = () => _this.overrideLabel || _this.t.html('label', { 'default': fieldID });
_this.label = () => _this.overrideLabel ?
selection => selection.text(_this.overrideLabel) :
_this.t.append('label', { 'default': fieldID });
const _placeholder = _this.placeholder;
_this.placeholder = () => _this.t('placeholder', { 'default': _placeholder });
+1 -1
View File
@@ -140,7 +140,7 @@ export function uiField(context, presetField, entityIDs, options) {
textEnter
.append('span')
.attr('class', 'label-textvalue')
.html(function(d) { return d.label(); });
.each(function(d) { d.label()(d3_select(this)); });
textEnter
.append('span')
+4 -4
View File
@@ -328,8 +328,8 @@ export function uiIntroArea(context, reveal) {
timeout(function() {
reveal('.more-fields .combobox-input',
helpHtml('intro.areas.add_field', {
name: { html: nameField.label() },
description: { html: descriptionField.label() }
name: nameField.title(),
description: descriptionField.title()
}),
{ duration: 300 }
);
@@ -395,7 +395,7 @@ export function uiIntroArea(context, reveal) {
}, 300);
reveal('div.combobox',
helpHtml('intro.areas.choose_field', { field: { html: descriptionField.label() } }),
helpHtml('intro.areas.choose_field', { field: descriptionField.title() }),
{ duration: 300 }
);
@@ -456,7 +456,7 @@ export function uiIntroArea(context, reveal) {
context.container().select('.inspector-wrap .panewrap').style('right', '0%');
reveal('.entity-editor-pane',
helpHtml('intro.areas.retry_add_field', { field: { html: descriptionField.label() } }), {
helpHtml('intro.areas.retry_add_field', { field: descriptionField.title() }), {
buttonText: t.html('intro.ok'),
buttonCallback: function() { continueTo(clickAddField); }
});
+4 -4
View File
@@ -493,8 +493,8 @@ export function uiIntroNavigation(context, reveal) {
reveal('.entity-editor-pane', helpHtml('intro.navigation.street_different_fields') + '{br}' +
helpHtml('intro.navigation.editor_street', {
button: { html: icon(href, 'inline') },
field1: { html: onewayField.label() },
field2: { html: maxspeedField.label() }
field1: onewayField.title(),
field2: maxspeedField.title()
}));
context.on('exit.intro', function() {
@@ -509,8 +509,8 @@ export function uiIntroNavigation(context, reveal) {
reveal('.entity-editor-pane', helpHtml('intro.navigation.street_different_fields') + '{br}' +
helpHtml('intro.navigation.editor_street', {
button: { html: icon(href, 'inline') },
field1: { html: onewayField.label() },
field2: { html: maxspeedField.label() }
field1: onewayField.title(),
field2: maxspeedField.title()
}), { duration: 0 }
);
});
+1 -1
View File
@@ -81,7 +81,7 @@ export function uiSectionPresetFields(context) {
var additionalFields = utilArrayUnion(sharedMoreFields, presetsManager.universal());
additionalFields.sort(function(field1, field2) {
return field1.label().localeCompare(field2.label(), localizer.localeCode());
return field1.title().localeCompare(field2.title(), localizer.localeCode());
});
additionalFields.forEach(function(field) {