aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision/form/FieldLabel.kt
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2019-10-17 21:58:34 +0200
committerRobert Jaros <rjaros@finn.pl>2019-10-17 21:58:34 +0200
commit736b80835f67c9c34657074ebcfbe0752bef1c18 (patch)
tree82d1e18a9ec07692dfe5dd31f470b842a9950a89 /src/main/kotlin/pl/treksoft/kvision/form/FieldLabel.kt
parent53b325d52208bfd44ba6a524ce3dda5379aed699 (diff)
downloadkvision-736b80835f67c9c34657074ebcfbe0752bef1c18.tar.gz
kvision-736b80835f67c9c34657074ebcfbe0752bef1c18.tar.bz2
kvision-736b80835f67c9c34657074ebcfbe0752bef1c18.zip
Move DSL builder functions out of the companion objects (#93)
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/form/FieldLabel.kt')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/FieldLabel.kt28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/FieldLabel.kt b/src/main/kotlin/pl/treksoft/kvision/form/FieldLabel.kt
index 4684b1be..8413eb3c 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/FieldLabel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/FieldLabel.kt
@@ -46,20 +46,18 @@ open class FieldLabel(
override fun getSnAttrs(): List<StringPair> {
return super.getSnAttrs() + ("for" to forId)
}
+}
- companion object {
- /**
- * DSL builder extension function.
- *
- * It takes the same parameters as the constructor of the built component.
- */
- fun Container.fieldLabel(
- forId: String, content: String? = null, rich: Boolean = false,
- classes: Set<String> = setOf("control-label"), init: (FieldLabel.() -> Unit)? = null
- ): FieldLabel {
- val fieldLabel = FieldLabel(forId, content, rich, classes).apply { init?.invoke(this) }
- this.add(fieldLabel)
- return fieldLabel
- }
- }
+/**
+ * DSL builder extension function.
+ *
+ * It takes the same parameters as the constructor of the built component.
+ */
+fun Container.fieldLabel(
+ forId: String, content: String? = null, rich: Boolean = false,
+ classes: Set<String> = setOf("control-label"), init: (FieldLabel.() -> Unit)? = null
+): FieldLabel {
+ val fieldLabel = FieldLabel(forId, content, rich, classes).apply { init?.invoke(this) }
+ this.add(fieldLabel)
+ return fieldLabel
}