diff options
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/html/Template.kt')
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/html/Template.kt | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Template.kt b/src/main/kotlin/pl/treksoft/kvision/html/Template.kt index d430d8ff..9a52eb5b 100644 --- a/src/main/kotlin/pl/treksoft/kvision/html/Template.kt +++ b/src/main/kotlin/pl/treksoft/kvision/html/Template.kt @@ -29,18 +29,24 @@ import pl.treksoft.kvision.i18n.I18n interface Template { var content: String? var rich: Boolean + /** + * @suppress + * Internal property + */ + var templateDataObj: Any? var template: ((Any?) -> String)? - val templates: Map<String, (Any?) -> String> + var templates: Map<String, (Any?) -> String> /** * Handlebars template data object. */ var templateData: Any? get() { - return null + return templateDataObj } set(value) { if (!rich) rich = true + templateDataObj = value content = template?.invoke(value) ?: templates.get(I18n.language)?.invoke(value) } } |