Better tag rendering stealing capacity

This commit is contained in:
Pieter Vander Vennet 2021-11-14 18:01:48 +01:00
parent c940890eca
commit b5693304f2
4 changed files with 104 additions and 213 deletions

View file

@ -42,6 +42,9 @@ export default class TagRenderingConfig {
}[]
constructor(json: string | TagRenderingConfigJson, context?: string) {
if (json === undefined) {
throw "Initing a TagRenderingConfig with undefined in " + context;
}
if (json === "questions") {
// Very special value
@ -55,14 +58,11 @@ export default class TagRenderingConfig {
if (typeof json === "number") {
this.render = Translations.T("" + json, context + ".render")
return;
json = ""+json
}
if (json === undefined) {
throw "Initing a TagRenderingConfig with undefined in " + context;
}
if (typeof json === "string") {
this.render = Translations.T(json, context + ".render");
this.multiAnswer = false;
@ -75,6 +75,8 @@ export default class TagRenderingConfig {
throw "Invalid ID in "+context+": an id can only contain [a-zA-Z0-0_-] as characters. The offending id is: "+this.id
}
this.group = json.group ?? "";
this.render = Translations.T(json.render, context + ".render");
this.question = Translations.T(json.question, context + ".question");