This commit is contained in:
Lars Westermann 2019-06-12 22:20:13 +02:00
parent 06e73365a9
commit 36bdad8036
Signed by: lars.westermann
GPG key ID: 9D417FA5BB9D5E1D
5 changed files with 29 additions and 2 deletions

View file

@ -24,6 +24,7 @@ class Calendar(calendar: HTMLElement) : View(calendar) {
private val htmlBody = document.body ?: createHtmlView()
val day = calendarTable.dataset["day"]?.toIntOrNull() ?: -1
val reloadOnFinish = calendarTable.dataset["reload"]?.toBoolean() ?: false
val referenceDate = calendarTable.dataset["reference"]?.toLongOrNull() ?: -1L
val nowDate = calendarTable.dataset["now"]?.toLongOrNull() ?: -1L
val timeDifference = Date.now().toLong() - nowDate

View file

@ -10,6 +10,7 @@ import org.w3c.dom.HTMLElement
import org.w3c.dom.INSTANT
import org.w3c.dom.SMOOTH
import org.w3c.dom.ScrollBehavior
import kotlin.browser.window
import kotlin.js.Date
import kotlin.math.max
import kotlin.math.min
@ -97,7 +98,10 @@ class CalendarBody(val calendar: Calendar, view: HTMLElement) : ViewCollection<C
var activeRow: CalendarRow? = null
var largestRowTime = Int.MIN_VALUE
for (row in this) {
largestRowTime = max(largestRowTime, row.time)
if (row.time == rowTime) {
row.classList.clear()
for (str in row.classList) {
@ -118,6 +122,10 @@ class CalendarBody(val calendar: Calendar, view: HTMLElement) : ViewCollection<C
}
}
if (largestRowTime < currentTime && calendar.reloadOnFinish) {
window.location.reload()
}
if (calendar.autoScroll && activeRow != null) {
if (calendar.orientation == Calendar.Orientation.ROOM_TO_TIME) {
calendar.scrollVerticalTo((activeRow.offsetTop - 150).toDouble(), scroll)

View file

@ -119,6 +119,21 @@
border-bottom: none;
}
& > div {
flex-grow: 0;
flex-shrink: 0;
}
.board-schedule-name {
flex-grow: 1 !important;
flex-shrink: 1 !important;
}
.board-schedule-room {
flex-grow: 1 !important;
flex-shrink: 1 !important;
}
.board-schedule-clock {
position: absolute;
left: 1rem;