aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2020-01-20 12:32:15 +0100
committerRobert Jaros <rjaros@finn.pl>2020-01-20 12:32:15 +0100
commit73ab234bad21da33c06020195870cb046b702239 (patch)
tree88f8c55ae8fa4b6a84d3e2f012acba991a1208d6 /kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft
parent5655c24a123e6b9557766186790cd4f7e6bfe011 (diff)
downloadkvision-73ab234bad21da33c06020195870cb046b702239.tar.gz
kvision-73ab234bad21da33c06020195870cb046b702239.tar.bz2
kvision-73ab234bad21da33c06020195870cb046b702239.zip
Fix empty links in Navbar and DropDown components
Diffstat (limited to 'kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft')
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt2
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/navbar/Navbar.kt17
2 files changed, 15 insertions, 4 deletions
diff --git a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt
index 891cd226..3fa6cd36 100644
--- a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt
+++ b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt
@@ -392,7 +392,7 @@ internal class DropDownButton(
inherited
} + listOf(
"data-toggle" to "dropdown", "aria-haspopup" to "true",
- "aria-expanded" to "false", "href" to "#"
+ "aria-expanded" to "false", "href" to "javascript:void(0)"
)
}
}
diff --git a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/navbar/Navbar.kt b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/navbar/Navbar.kt
index 68975f8d..c6f6fe3f 100644
--- a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/navbar/Navbar.kt
+++ b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/navbar/Navbar.kt
@@ -64,7 +64,8 @@ enum class NavbarExpand(internal val navbarExpand: String) {
* The Bootstrap Navbar container.
*
* @constructor
- * @param label the navbar label
+ * @param label the navbar header label
+ * @param link the navbar header link
* @param type the navbar type
* @param expand the navbar responsive behavior
* @param nColor the navbar color
@@ -74,6 +75,7 @@ enum class NavbarExpand(internal val navbarExpand: String) {
*/
open class Navbar(
label: String? = null,
+ link: String? = null,
type: NavbarType? = null,
expand: NavbarExpand? = NavbarExpand.LG,
nColor: NavbarColor = NavbarColor.LIGHT,
@@ -94,6 +96,14 @@ open class Navbar(
brandLink.hide()
}
}
+ /**
+ * The navbar header link.
+ */
+ var link
+ get() = brandLink.url
+ set(value) {
+ brandLink.url = value
+ }
/**
* The navbar type.
@@ -114,7 +124,7 @@ open class Navbar(
private val idc = "kv_navbar_$counter"
- private val brandLink = Link(label ?: "", "#", classes = setOf("navbar-brand"))
+ private val brandLink = Link(label ?: "", link, classes = setOf("navbar-brand"))
internal val container = SimplePanel(setOf("collapse", "navbar-collapse")) {
id = idc
}
@@ -183,13 +193,14 @@ open class Navbar(
*/
fun Container.navbar(
label: String? = null,
+ link: String? = null,
type: NavbarType? = null,
expand: NavbarExpand? = NavbarExpand.LG,
nColor: NavbarColor = NavbarColor.LIGHT,
bgColor: BsBgColor = BsBgColor.LIGHT,
classes: Set<String> = setOf(), init: (Navbar.() -> Unit)? = null
): Navbar {
- val navbar = Navbar(label, type, expand, nColor, bgColor, classes, init)
+ val navbar = Navbar(label, link, type, expand, nColor, bgColor, classes, init)
this.add(navbar)
return navbar
}