From d9979940ee616460da8b6c50b605f991958366ef Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Mon, 18 Jul 2022 00:57:46 +0200 Subject: [PATCH] Improve documentation --- .../Json/TagRenderingConfigJson.ts | 38 ++++++++++++++++++- assets/layers/toilet/toilet.json | 3 +- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/Models/ThemeConfig/Json/TagRenderingConfigJson.ts b/Models/ThemeConfig/Json/TagRenderingConfigJson.ts index b04ef35a2..88b225800 100644 --- a/Models/ThemeConfig/Json/TagRenderingConfigJson.ts +++ b/Models/ThemeConfig/Json/TagRenderingConfigJson.ts @@ -35,9 +35,43 @@ export interface TagRenderingConfigJson { render?: string | any, /** - * Only show this tagrendering (or question) if the object also matches the following tags. + * Only show this tagrendering (or ask the question) if the selected object also matches the tags specified as `condition`. * - * This is useful to ask a follow-up question. E.g. if there is a diaper table, then ask a follow-up question on diaper tables... + * This is useful to ask a follow-up question. + * For example, within toilets, asking _where_ the diaper changing table is is only useful _if_ there is one. + * This can be done by adding `"condition": "changing_table=yes"` + * + * A full example would be: + * ```json + * { + * "question": "Where is the changing table located?", + * "render": "The changing table is located at {changing_table:location}", + * "condition": "changing_table=yes", + * "freeform": { + * "key": "changing_table:location", + * "inline": true + * }, + * "mappings": [ + * { + * "then": "The changing table is in the toilet for women.", + * "if": "changing_table:location=female_toilet" + * }, + * { + * "then": "The changing table is in the toilet for men.", + * "if": "changing_table:location=male_toilet" + * }, + * { + * "if": "changing_table:location=wheelchair_toilet", + * "then": "The changing table is in the toilet for wheelchair users.", + * }, + * { + * "if": "changing_table:location=dedicated_room", + * "then": "The changing table is in a dedicated room. ", + * } + * ], + * "id": "toilet-changing_table:location" + * }, + * ``` * */ condition?: TagConfigJson; diff --git a/assets/layers/toilet/toilet.json b/assets/layers/toilet/toilet.json index daaa6ecb4..5dfeb438d 100644 --- a/assets/layers/toilet/toilet.json +++ b/assets/layers/toilet/toilet.json @@ -386,7 +386,8 @@ }, "condition": "changing_table=yes", "freeform": { - "key": "changing_table:location" + "key": "changing_table:location", + "inline": true }, "mappings": [ {