aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/pl')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/html/Tag.kt12
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/html/Template.kt10
2 files changed, 18 insertions, 4 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Tag.kt b/src/main/kotlin/pl/treksoft/kvision/html/Tag.kt
index 03686fa0..48f6a9eb 100644
--- a/src/main/kotlin/pl/treksoft/kvision/html/Tag.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/html/Tag.kt
@@ -125,6 +125,11 @@ open class Tag(
*/
var align by refreshOnUpdate(align)
/**
+ * @suppress
+ * Internal property
+ */
+ override var templateDataObj: Any? = null
+ /**
* Handlebars template.
*/
override var template: ((Any?) -> String)? by refreshOnUpdate()
@@ -139,8 +144,11 @@ open class Tag(
}
override fun render(): VNode {
- if (templateData != null && lastLanguage != null && lastLanguage != I18n.language)
- templateData = templateData
+ if (templateDataObj != null && lastLanguage != null && lastLanguage != I18n.language) {
+ getRoot()?.renderDisabled = true
+ templateData = templateDataObj
+ getRoot()?.renderDisabled = false
+ }
return if (content != null) {
val translatedContent = content?.let { translate(it) }
if (rich) {
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)
}
}