Add the possibility to show all questions of a group as one + documentation update

This commit is contained in:
Pieter Vander Vennet 2021-11-12 01:44:13 +01:00
parent 3570cfbaa8
commit 519feaa54b
10 changed files with 140 additions and 34 deletions

View file

@ -104,6 +104,12 @@ export default class TagRenderingConfig {
throw `Freeform.args is defined. This should probably be 'freeform.helperArgs' (at ${context})`
}
if(json.freeform.key === "questions"){
if(this.id !== "questions"){
throw `If you use a freeform key 'questions', the ID must be 'questions' too to trigger the special behaviour. The current id is '${this.id}' (at ${context})`
}
}
if (ValidatedTextField.AllTypes[this.freeform.type] === undefined) {
@ -186,6 +192,9 @@ export default class TagRenderingConfig {
throw `${context}: The rendering for language ${ln} does not contain {questions}. This is a bug, as this rendering should include exactly this to trigger those questions to be shown!`
}
if(this.freeform?.key !== undefined && this.freeform?.key !== "questions"){
throw `${context}: If the ID is questions to trigger a question box, the only valid freeform value is 'questions' as well. Set freeform to questions or remove the freeform all together`
}
}
@ -201,6 +210,9 @@ export default class TagRenderingConfig {
if(txt.indexOf("{"+this.freeform.key+"}") >= 0){
continue
}
if(txt.indexOf("{"+this.freeform.key+":") >= 0){
continue
}
if(txt.indexOf("{canonical("+this.freeform.key+")") >= 0){
continue
}
@ -363,6 +375,9 @@ export default class TagRenderingConfig {
}
}
if(this.id === "questions"){
return this.render
}
if (this.freeform?.key === undefined) {
return this.render;