Fix small issue: wrong format for addExtraTags in some layers

This commit is contained in:
pietervdvn 2021-03-31 15:50:29 +02:00
parent edd10d52fd
commit e47accbab1
4 changed files with 53 additions and 51 deletions

View file

@ -70,6 +70,9 @@ export default class TagRenderingConfig {
addExtraTags: json.freeform.addExtraTags?.map((tg, i) => addExtraTags: json.freeform.addExtraTags?.map((tg, i) =>
FromJSON.Tag(tg, `${context}.extratag[${i}]`)) ?? [] FromJSON.Tag(tg, `${context}.extratag[${i}]`)) ?? []
} }
if(json.freeform["extraTags"] !== undefined){
throw `Freeform.extraTags is defined. This should probably be 'freeform.addExtraTag' (at ${context})`
}
if (this.freeform.key === undefined || this.freeform.key === "") { if (this.freeform.key === undefined || this.freeform.key === "") {
throw `Freeform.key is undefined or the empty string - this is not allowed; either fill out something or remove the freeform block alltogether. Error in ${context}` throw `Freeform.key is undefined or the empty string - this is not allowed; either fill out something or remove the freeform block alltogether. Error in ${context}`
} }

View file

@ -94,6 +94,18 @@ export default class TagRenderingQuestion extends UIElement {
).SetClass("block") ).SetClass("block")
} }
InnerRender(): string {
return new Combine([
this._question,
this._inputElement,
this._cancelButton,
this._saveButton,
this._appliedTags]
)
.SetClass("question")
.Render()
}
private GenerateInputElement(): InputElement<TagsFilter> { private GenerateInputElement(): InputElement<TagsFilter> {
const ff = this.GenerateFreeform(); const ff = this.GenerateFreeform();
const self = this; const self = this;
@ -232,7 +244,6 @@ export default class TagRenderingQuestion extends UIElement {
(t0, t1) => t1.isEquivalent(t0)); (t0, t1) => t1.isEquivalent(t0));
} }
private GenerateFreeform(): InputElement<TagsFilter> { private GenerateFreeform(): InputElement<TagsFilter> {
const freeform = this._configuration.freeform; const freeform = this._configuration.freeform;
if (freeform === undefined) { if (freeform === undefined) {
@ -287,16 +298,4 @@ export default class TagRenderingQuestion extends UIElement {
} }
InnerRender(): string {
return new Combine([
this._question,
this._inputElement,
this._cancelButton,
this._saveButton,
this._appliedTags]
)
.SetClass("question")
.Render()
}
} }

View file

@ -65,7 +65,7 @@
}, },
"freeform": { "freeform": {
"key": "charge", "key": "charge",
"extraTags": ["fee=yes"] "addExtraTags": ["fee=yes"]
}, },
"mappings": [ "mappings": [
{ {

View file

@ -67,7 +67,7 @@
}, },
"freeform": { "freeform": {
"key": "bicycle_parking", "key": "bicycle_parking",
"extraTags": [ "addExtraTags": [
"fixme=Freeform used on 'bicycle_parking'-tag: possibly a wrong value" "fixme=Freeform used on 'bicycle_parking'-tag: possibly a wrong value"
] ]
}, },
@ -260,7 +260,7 @@
}, },
"freeform": { "freeform": {
"key": "access", "key": "access",
"extraTags": [ "addExtraTags": [
"fixme=Freeform used on 'access'-tag: possibly a wrong value" "fixme=Freeform used on 'access'-tag: possibly a wrong value"
] ]
}, },