Bugfixes
This commit is contained in:
parent
06e73365a9
commit
36bdad8036
|
@ -24,6 +24,7 @@ class Calendar(calendar: HTMLElement) : View(calendar) {
|
||||||
private val htmlBody = document.body ?: createHtmlView()
|
private val htmlBody = document.body ?: createHtmlView()
|
||||||
|
|
||||||
val day = calendarTable.dataset["day"]?.toIntOrNull() ?: -1
|
val day = calendarTable.dataset["day"]?.toIntOrNull() ?: -1
|
||||||
|
val reloadOnFinish = calendarTable.dataset["reload"]?.toBoolean() ?: false
|
||||||
val referenceDate = calendarTable.dataset["reference"]?.toLongOrNull() ?: -1L
|
val referenceDate = calendarTable.dataset["reference"]?.toLongOrNull() ?: -1L
|
||||||
val nowDate = calendarTable.dataset["now"]?.toLongOrNull() ?: -1L
|
val nowDate = calendarTable.dataset["now"]?.toLongOrNull() ?: -1L
|
||||||
val timeDifference = Date.now().toLong() - nowDate
|
val timeDifference = Date.now().toLong() - nowDate
|
||||||
|
|
|
@ -10,6 +10,7 @@ import org.w3c.dom.HTMLElement
|
||||||
import org.w3c.dom.INSTANT
|
import org.w3c.dom.INSTANT
|
||||||
import org.w3c.dom.SMOOTH
|
import org.w3c.dom.SMOOTH
|
||||||
import org.w3c.dom.ScrollBehavior
|
import org.w3c.dom.ScrollBehavior
|
||||||
|
import kotlin.browser.window
|
||||||
import kotlin.js.Date
|
import kotlin.js.Date
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
|
@ -97,7 +98,10 @@ class CalendarBody(val calendar: Calendar, view: HTMLElement) : ViewCollection<C
|
||||||
|
|
||||||
var activeRow: CalendarRow? = null
|
var activeRow: CalendarRow? = null
|
||||||
|
|
||||||
|
var largestRowTime = Int.MIN_VALUE
|
||||||
|
|
||||||
for (row in this) {
|
for (row in this) {
|
||||||
|
largestRowTime = max(largestRowTime, row.time)
|
||||||
if (row.time == rowTime) {
|
if (row.time == rowTime) {
|
||||||
row.classList.clear()
|
row.classList.clear()
|
||||||
for (str in row.classList) {
|
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.autoScroll && activeRow != null) {
|
||||||
if (calendar.orientation == Calendar.Orientation.ROOM_TO_TIME) {
|
if (calendar.orientation == Calendar.Orientation.ROOM_TO_TIME) {
|
||||||
calendar.scrollVerticalTo((activeRow.offsetTop - 150).toDouble(), scroll)
|
calendar.scrollVerticalTo((activeRow.offsetTop - 150).toDouble(), scroll)
|
||||||
|
|
|
@ -119,6 +119,21 @@
|
||||||
border-bottom: none;
|
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 {
|
.board-schedule-clock {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 1rem;
|
left: 1rem;
|
||||||
|
|
|
@ -174,7 +174,8 @@ fun Route.board() {
|
||||||
min,
|
min,
|
||||||
max,
|
max,
|
||||||
rooms,
|
rooms,
|
||||||
schedules
|
schedules,
|
||||||
|
reloadAfterFinish = true
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
div("board-twitter") {
|
div("board-twitter") {
|
||||||
|
|
|
@ -70,7 +70,8 @@ fun DIV.renderCalendar(
|
||||||
from: Int,
|
from: Int,
|
||||||
to: Int,
|
to: Int,
|
||||||
rooms: List<Room>,
|
rooms: List<Room>,
|
||||||
schedules: Map<Room, Map<Int, List<Schedule>>>
|
schedules: Map<Room, Map<Int, List<Schedule>>>,
|
||||||
|
reloadAfterFinish: Boolean = false
|
||||||
) {
|
) {
|
||||||
val gridLabelWidth = 60
|
val gridLabelWidth = 60
|
||||||
val minutesOfDay = to - from
|
val minutesOfDay = to - from
|
||||||
|
@ -85,6 +86,7 @@ fun DIV.renderCalendar(
|
||||||
attributes["data-day"] = day.toString()
|
attributes["data-day"] = day.toString()
|
||||||
attributes["data-reference"] = Configuration.Schedule.referenceDate.time.toString()
|
attributes["data-reference"] = Configuration.Schedule.referenceDate.time.toString()
|
||||||
attributes["data-now"] = now.timeInMillis.toString()
|
attributes["data-now"] = now.timeInMillis.toString()
|
||||||
|
attributes["data-reload"] = reloadAfterFinish.toString()
|
||||||
|
|
||||||
div("calendar-table-box ${orientation.name.toLowerCase().replace("_", "-")}") {
|
div("calendar-table-box ${orientation.name.toLowerCase().replace("_", "-")}") {
|
||||||
div("calendar-header") {
|
div("calendar-header") {
|
||||||
|
|
Loading…
Reference in a new issue