mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 09:12:52 +00:00
Support a more verbose format for listing issues
Includes the feature type in the label (re: https://github.com/osmlab/name-suggestion-index/issues/4543#issuecomment-791919134)
This commit is contained in:
@@ -216,21 +216,29 @@ export function utilDisplayType(id) {
|
||||
}
|
||||
|
||||
|
||||
export function utilDisplayLabel(entity, graphOrGeometry) {
|
||||
// `utilDisplayLabel`
|
||||
// Returns a string suitable for display
|
||||
// By default returns something like name/ref, fallback to preset type, fallback to OSM type
|
||||
// "Main Street" or "Tertiary Road"
|
||||
// If `verbose=true`, include both preset name and feature name.
|
||||
// "Tertiary Road Main Street"
|
||||
//
|
||||
export function utilDisplayLabel(entity, graphOrGeometry, verbose) {
|
||||
var result;
|
||||
var displayName = utilDisplayName(entity);
|
||||
if (displayName) {
|
||||
// use the display name if there is one
|
||||
return displayName;
|
||||
}
|
||||
var preset = typeof graphOrGeometry === 'string' ?
|
||||
presetManager.matchTags(entity.tags, graphOrGeometry) :
|
||||
presetManager.match(entity, graphOrGeometry);
|
||||
if (preset && preset.name()) {
|
||||
// use the preset name if there is a match
|
||||
return preset.name();
|
||||
var presetName = preset && preset.name();
|
||||
|
||||
if (verbose) {
|
||||
result = [presetName, displayName].filter(Boolean).join(' ');
|
||||
} else {
|
||||
result = displayName || presetName;
|
||||
}
|
||||
// fallback to the display type (node/way/relation)
|
||||
return utilDisplayType(entity.id);
|
||||
|
||||
// Fallback to the OSM type (node/way/relation)
|
||||
return result || utilDisplayType(entity.id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -146,7 +146,9 @@ export function validationOutdatedTags() {
|
||||
if (subtype === 'noncanonical_brand' && isOnlyAddingTags) {
|
||||
messageID += '_incomplete';
|
||||
}
|
||||
return t.html(messageID, { feature: utilDisplayLabel(currEntity, context.graph()) });
|
||||
return t.html(messageID, {
|
||||
feature: utilDisplayLabel(currEntity, context.graph(), true /* verbose */)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user