From 6db71915b44c398b7046e4fdc129f0353e8a7465 Mon Sep 17 00:00:00 2001 From: Lars Westermann Date: Thu, 13 Jun 2019 02:59:53 +0200 Subject: [PATCH] Bugfixes --- src/jsMain/kotlin/de/kif/frontend/main.kt | 14 ++++++++++++++ .../de/kif/frontend/views/calendar/CalendarEdit.kt | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/jsMain/kotlin/de/kif/frontend/main.kt b/src/jsMain/kotlin/de/kif/frontend/main.kt index 8dc9572..aa72d9c 100644 --- a/src/jsMain/kotlin/de/kif/frontend/main.kt +++ b/src/jsMain/kotlin/de/kif/frontend/main.kt @@ -9,9 +9,12 @@ import de.kif.frontend.views.overview.initOverviewMain import de.kif.frontend.views.overview.initPostEdit import de.kif.frontend.views.overview.initPosts import de.kif.frontend.views.table.initTableLayout +import de.westermann.kwebview.View import de.westermann.kwebview.components.init +import de.westermann.kwebview.iterator import org.w3c.dom.get import kotlin.browser.document +import kotlin.browser.window var timezoneOffset = 0L @@ -47,4 +50,15 @@ fun main() = init { if (document.getElementsByClassName("announcement").length > 0) { initAnnouncement() } + + for (btn in document.getElementsByClassName("btn-danger").iterator()) { + View.wrap(btn).onClick { + val result = window.confirm("Wollen Sie wirklich löschen?") + + if (!result) { + it.stopPropagation() + it.preventDefault() + } + } + } } diff --git a/src/jsMain/kotlin/de/kif/frontend/views/calendar/CalendarEdit.kt b/src/jsMain/kotlin/de/kif/frontend/views/calendar/CalendarEdit.kt index 840f642..a5d6494 100644 --- a/src/jsMain/kotlin/de/kif/frontend/views/calendar/CalendarEdit.kt +++ b/src/jsMain/kotlin/de/kif/frontend/views/calendar/CalendarEdit.kt @@ -107,7 +107,7 @@ class CalendarEdit( val schedules = scheduled[schedule.workGroup] ?: emptyList() scheduled += schedule.workGroup to schedules + schedule - + workGroupList.firstOrNull { it.workGroup.id == schedule.workGroup.id }?.isScheduled = !showAll && schedule.workGroup in scheduled }