diff options
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision')
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt | 2 | ||||
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/html/Link.kt | 12 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt b/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt index 4622ceca..8a37cf6c 100644 --- a/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt +++ b/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt @@ -190,7 +190,7 @@ open class DropDown( DD.SEPARATOR.option -> Separator() DD.DISABLED.option -> { val tag = Tag(TAG.LI, classes = setOf("disabled")) - tag.add(Link(it.first, "javascript:void(0)")) + tag.add(Link(it.first)) tag } else -> Link(it.first, it.second) diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Link.kt b/src/main/kotlin/pl/treksoft/kvision/html/Link.kt index 50a45047..d1cf9a12 100644 --- a/src/main/kotlin/pl/treksoft/kvision/html/Link.kt +++ b/src/main/kotlin/pl/treksoft/kvision/html/Link.kt @@ -39,7 +39,7 @@ import pl.treksoft.kvision.panel.SimplePanel * @param classes a set of CSS class names */ open class Link( - label: String, url: String, icon: String? = null, image: ResString? = null, + label: String, url: String? = null, icon: String? = null, image: ResString? = null, classes: Set<String> = setOf() ) : SimplePanel(classes) { /** @@ -65,7 +65,11 @@ open class Link( } override fun getSnAttrs(): List<StringPair> { - return super.getSnAttrs() + ("href" to url) + val pr = super.getSnAttrs().toMutableList() + url?.let { + pr.add("href" to it) + } + return pr } companion object { @@ -75,7 +79,7 @@ open class Link( * It takes the same parameters as the constructor of the built component. */ fun Container.link( - label: String, url: String, icon: String? = null, image: ResString? = null, + label: String, url: String? = null, icon: String? = null, image: ResString? = null, classes: Set<String> = setOf(), init: (Link.() -> Unit)? = null ): Link { val link = Link(label, url, icon, image, classes).apply { init?.invoke(this) } @@ -92,7 +96,7 @@ open class Link( label: String, icon: String? = null, image: ResString? = null, classes: Set<String> = setOf(), init: (Link.() -> Unit)? = null ): Link { - val link = Link(label, "javascript:void(0)", icon, image, classes).apply { init?.invoke(this) } + val link = Link(label, null, icon, image, classes).apply { init?.invoke(this) } val tag = Tag(TAG.LI, classes = setOf("disabled")) tag.add(link) this.add(tag) |