From 6f3c026c4d70cb9c7b3ee156e988b6320e0ceb28 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Fri, 23 Mar 2018 13:18:22 +0100 Subject: Small fixes for links in dropdowns. --- src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt | 2 +- src/main/kotlin/pl/treksoft/kvision/html/Link.kt | 12 ++++++++---- src/main/resources/css/style.css | 4 ++++ 3 files changed, 13 insertions(+), 5 deletions(-) (limited to 'src/main') 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 = setOf() ) : SimplePanel(classes) { /** @@ -65,7 +65,11 @@ open class Link( } override fun getSnAttrs(): List { - 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 = 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 = 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) diff --git a/src/main/resources/css/style.css b/src/main/resources/css/style.css index 9df9960b..d6242ddd 100644 --- a/src/main/resources/css/style.css +++ b/src/main/resources/css/style.css @@ -131,3 +131,7 @@ trix-toolbar .trix-button-group { .kv-window .modal-header .modal-title { white-space: nowrap; } + +ul.dropdown-menu li a { + cursor: pointer; +} -- cgit