aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2018-01-28 13:56:40 +0100
committerRobert Jaros <rjaros@finn.pl>2018-01-28 13:56:40 +0100
commit2a41a8ad23556630ee09050ffdaacd96301a5924 (patch)
treee07992ceaac36787acefb660ac533bba163ff7df
parentc8922a145826834a0be8059cb5b8c6fd5da593dd (diff)
downloadkvision-2a41a8ad23556630ee09050ffdaacd96301a5924.tar.gz
kvision-2a41a8ad23556630ee09050ffdaacd96301a5924.tar.bz2
kvision-2a41a8ad23556630ee09050ffdaacd96301a5924.zip
Squared radio fixes
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/check/Radio.kt4
-rw-r--r--src/main/resources/css/style.css4
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioSpec.kt2
3 files changed, 8 insertions, 2 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/check/Radio.kt b/src/main/kotlin/pl/treksoft/kvision/form/check/Radio.kt
index 1ec63f60..4dc0ac90 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/check/Radio.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/check/Radio.kt
@@ -18,7 +18,7 @@ enum class RADIOSTYLE(val className: String) {
}
open class Radio(
- value: Boolean = false, extraValue: String? = null, label: String? = null,
+ value: Boolean = false, extraValue: String? = null, name: String? = null, label: String? = null,
rich: Boolean = false
) : SimplePanel(), BoolFormControl {
@@ -82,6 +82,7 @@ open class Radio(
final override val input: CheckInput = CheckInput(CHECKINPUTTYPE.RADIO, value).apply {
this.id = idc
this.extraValue = extraValue
+ this.name = name
}
final override val flabel: FieldLabel = FieldLabel(idc, label, rich, classes = setOf())
final override val validationInfo: HelpBlock = HelpBlock().apply { visible = false }
@@ -127,6 +128,7 @@ open class Radio(
}
} else {
cl.add("checkbox" to true)
+ cl.add("kv-radio-checkbox" to true)
style?.let {
cl.add(it.className.replace("radio", "checkbox") to true)
}
diff --git a/src/main/resources/css/style.css b/src/main/resources/css/style.css
index 3e7ee728..71aeface 100644
--- a/src/main/resources/css/style.css
+++ b/src/main/resources/css/style.css
@@ -114,3 +114,7 @@ trix-toolbar .trix-button-group {
.kv-radiogroup-inline label {
margin-right: 10px;
}
+
+.kv-radio-checkbox {
+ padding-left: 7px;
+}
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioSpec.kt
index d32a84a3..6eedfd27 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/form/check/RadioSpec.kt
@@ -32,7 +32,7 @@ class RadioSpec : DomSpec {
ci.squared = true
ci.inline = false
assertEquals(
- "<div class=\"checkbox checkbox-info\"><input id=\"$id\" type=\"radio\" checked=\"\" name=\"name\" disabled=\"\" value=\"abc\"><label for=\"$id\">Label</label></div>",
+ "<div class=\"checkbox kv-radio-checkbox checkbox-info\"><input id=\"$id\" type=\"radio\" checked=\"\" name=\"name\" disabled=\"\" value=\"abc\"><label for=\"$id\">Label</label></div>",
element?.innerHTML,
"Should render correct radio button form control"
)