aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2018-03-10 19:04:29 +0100
committerRobert Jaros <rjaros@finn.pl>2018-03-10 19:04:29 +0100
commit3577c10b5c3839a06f64cb19e72788401bd7406d (patch)
treebbb8f2531b547b3074806b2661abc10c183cfb9c /src
parent9e7c88917461e5941ed742fe8ed855b7c07cf8fa (diff)
downloadkvision-3577c10b5c3839a06f64cb19e72788401bd7406d.tar.gz
kvision-3577c10b5c3839a06f64cb19e72788401bd7406d.tar.bz2
kvision-3577c10b5c3839a06f64cb19e72788401bd7406d.zip
Support for Bootswatch and other css themes.
Diffstat (limited to 'src')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/KVManager.kt12
-rw-r--r--src/main/resources/css/paper.css12
2 files changed, 23 insertions, 1 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/KVManager.kt b/src/main/kotlin/pl/treksoft/kvision/KVManager.kt
index 0030cf9d..e1c169c0 100644
--- a/src/main/kotlin/pl/treksoft/kvision/KVManager.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/KVManager.kt
@@ -29,6 +29,7 @@ import com.github.snabbdom.datasetModule
import com.github.snabbdom.eventListenersModule
import com.github.snabbdom.propsModule
import com.github.snabbdom.styleModule
+import org.w3c.dom.asList
import pl.treksoft.kvision.core.Component
import pl.treksoft.kvision.utils.isIE11
import kotlin.browser.document
@@ -48,8 +49,17 @@ internal object KVManager {
internal const val AJAX_REQUEST_DELAY = 300
internal const val KVNULL = "#kvnull"
+ private val links = document.getElementsByTagName("link")
private val bootstrapWebpack = try {
- require("bootstrap-webpack")
+ val bootswatch = links.asList().find { it.getAttribute("href")?.contains("bootstrap.min.css") ?: false }
+ if (bootswatch != null) {
+ if (bootswatch.getAttribute("href")?.contains("/paper/") ?: false) {
+ require("./css/paper.css")
+ }
+ require("bootstrap-webpack!./js/bootstrap.config.js")
+ } else {
+ require("bootstrap-webpack")
+ }
} catch (e: Throwable) {
}
private val fontAwesomeWebpack = try {
diff --git a/src/main/resources/css/paper.css b/src/main/resources/css/paper.css
new file mode 100644
index 00000000..6e923117
--- /dev/null
+++ b/src/main/resources/css/paper.css
@@ -0,0 +1,12 @@
+body {
+ font-size: 14px;
+ line-height: 1.42857143;
+}
+
+.kv-radio-checkbox {
+ padding-left: 20px !important;
+}
+
+.radio label, .checkbox label {
+ white-space: nowrap;
+}