Add id to tagRenderingConfig

This commit is contained in:
Pieter Vander Vennet 2021-09-26 17:54:49 +02:00
parent 3780c5d380
commit 1d6102f6de
2 changed files with 9 additions and 0 deletions

View file

@ -5,6 +5,13 @@ import {AndOrTagConfigJson} from "./TagConfigJson";
* If the desired tags are missing and a question is defined, a question will be shown instead. * If the desired tags are missing and a question is defined, a question will be shown instead.
*/ */
export interface TagRenderingConfigJson { export interface TagRenderingConfigJson {
/**
* The id of the tagrendering, should be an unique string.
* Used to keep the translations in sync
*/
id?: string,
/** /**
* Renders this value. Note that "{key}"-parts are substituted by the corresponding values of the element. * Renders this value. Note that "{key}"-parts are substituted by the corresponding values of the element.
* If neither 'textFieldQuestion' nor 'mappings' are defined, this text is simply shown as default value. * If neither 'textFieldQuestion' nor 'mappings' are defined, this text is simply shown as default value.

View file

@ -13,6 +13,7 @@ import {Utils} from "../../Utils";
*/ */
export default class TagRenderingConfig { export default class TagRenderingConfig {
readonly id?: string;
readonly render?: Translation; readonly render?: Translation;
readonly question?: Translation; readonly question?: Translation;
readonly condition?: TagsFilter; readonly condition?: TagsFilter;
@ -56,6 +57,7 @@ export default class TagRenderingConfig {
return; return;
} }
this.id = json.id ?? "";
this.render = Translations.T(json.render, context + ".render"); this.render = Translations.T(json.render, context + ".render");
this.question = Translations.T(json.question, context + ".question"); this.question = Translations.T(json.question, context + ".question");
this.roaming = json.roaming ?? false; this.roaming = json.roaming ?? false;