mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-31 01:09:22 +02:00
Make reference function optional
Now it shows the "No documentation available" message if there is not one
This commit is contained in:
@@ -334,7 +334,7 @@ export function validationIssue(attrs) {
|
||||
this.type = attrs.type; // required
|
||||
this.severity = attrs.severity; // required - 'warning' or 'error'
|
||||
this.message = attrs.message; // required - localized string
|
||||
this.reference = attrs.reference; // required - function(selection) to render reference info
|
||||
this.reference = attrs.reference; // optional - function(selection) to render reference info
|
||||
this.entities = attrs.entities; // optional - array of entities
|
||||
this.loc = attrs.loc; // optional - expect a [lon, lat] array
|
||||
this.data = attrs.data; // optional - object containing extra data for the fixes
|
||||
|
||||
@@ -160,8 +160,13 @@ export function uiEntityIssues(context) {
|
||||
.style('max-height', '0')
|
||||
.style('opacity', '0')
|
||||
.each(function(d) {
|
||||
d3_select(this)
|
||||
.call(d.reference);
|
||||
if (typeof d.reference === 'function') {
|
||||
d3_select(this)
|
||||
.call(d.reference);
|
||||
} else {
|
||||
d3_select(this)
|
||||
.text(t('inspector.no_documentation_key'));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user