diff --git a/src/Logic/Tags/TagUtils.ts b/src/Logic/Tags/TagUtils.ts index 94c60522b..91ce6c5e1 100644 --- a/src/Logic/Tags/TagUtils.ts +++ b/src/Logic/Tags/TagUtils.ts @@ -132,6 +132,9 @@ export class TagUtils { /** * Given multiple tagsfilters which can be used as answer, will take the tags with the same keys together as set. + * + * @see MatchesMultiAnswer to do the reverse + * * E.g: * * const tag = TagUtils.ParseUploadableTag({"and": [ diff --git a/src/Models/ThemeConfig/TagRenderingConfig.ts b/src/Models/ThemeConfig/TagRenderingConfig.ts index 2039022e8..dafdd4e59 100644 --- a/src/Models/ThemeConfig/TagRenderingConfig.ts +++ b/src/Models/ThemeConfig/TagRenderingConfig.ts @@ -243,7 +243,10 @@ export default class TagRenderingConfig { if (txt === "") { throw context + " Rendering for language " + ln + " is empty" } - if (txt.indexOf("{" + this.freeform.key + "}") >= 0 || txt.indexOf("&LBRACE" + this.freeform.key + "&RBRACE") ) { + if ( + txt.indexOf("{" + this.freeform.key + "}") >= 0 || + txt.indexOf("&LBRACE" + this.freeform.key + "&RBRACE") + ) { continue } if (txt.indexOf("{" + this.freeform.key + ":") >= 0) { @@ -645,6 +648,16 @@ export default class TagRenderingConfig { /** * Given a value for the freeform key and an overview of the selected mappings, construct the correct tagsFilter to apply * + * const config = new TagRenderingConfig({"id":"bookcase-booktypes","render":{"en":"This place mostly serves {books}" }, + * "question":{"en":"What kind of books can be found in this public bookcase?"}, + * "freeform":{"key":"books","addExtraTags":["fixme=Freeform tag `books` used, to be doublechecked"], + * "inline":true}, + * "multiAnswer":true, + * "mappings":[{"if":"books=children","then":"Mostly children books"}, + * {"if":"books=adults","then": "Mostly books for adults"}]} + * , "testcase") + * config.constructChangeSpecification(undefined, undefined, [false, true, false], {amenity: "public_bookcase"}) // => new And([new Tag("books","adult")]) + * * @param freeformValue The freeform value which will be applied as 'freeform.key'. Ignored if 'freeform.key' is not set * * @param singleSelectedMapping (Only used if multiAnswer == false): the single mapping to apply. Use (mappings.length) for the freeform diff --git a/src/UI/Popup/TagRendering/TagRenderingQuestion.svelte b/src/UI/Popup/TagRendering/TagRenderingQuestion.svelte index 8f0979dad..0522baf0e 100644 --- a/src/UI/Popup/TagRendering/TagRenderingQuestion.svelte +++ b/src/UI/Popup/TagRendering/TagRenderingQuestion.svelte @@ -1,76 +1,114 @@ {#if config.question !== undefined}