mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-24 00:54:03 +02:00
Add entity display label util function
Condense message and tooltip text for for the untagged feature issue Use lighter border color for error issues
This commit is contained in:
@@ -4,6 +4,7 @@ export { utilCleanTags } from './clean_tags';
|
||||
export { utilDisplayName } from './util';
|
||||
export { utilDisplayNameForPath } from './util';
|
||||
export { utilDisplayType } from './util';
|
||||
export { utilDisplayLabel } from './util';
|
||||
export { utilEditDistance } from './util';
|
||||
export { utilEntitySelector } from './util';
|
||||
export { utilEntityOrMemberSelector } from './util';
|
||||
|
||||
@@ -121,6 +121,22 @@ export function utilDisplayType(id) {
|
||||
}
|
||||
|
||||
|
||||
export function utilDisplayLabel(entity, context) {
|
||||
var displayName = utilDisplayName(entity);
|
||||
if (displayName) {
|
||||
// use the display name if there is one
|
||||
return displayName;
|
||||
}
|
||||
var preset = context.presets().match(entity, context.graph());
|
||||
if (preset && preset.name()) {
|
||||
// use the preset name if there is a match
|
||||
return preset.name();
|
||||
}
|
||||
// fallback to the display type (node/way/relation)
|
||||
return utilDisplayType(entity.id);
|
||||
}
|
||||
|
||||
|
||||
export function utilStringQs(str) {
|
||||
return str.split('&').reduce(function(obj, pair){
|
||||
var parts = pair.split('=');
|
||||
|
||||
Reference in New Issue
Block a user