This commit is contained in:
Lars Westermann 2019-06-12 21:46:34 +02:00
parent 94803ba805
commit 06e73365a9
Signed by: lars.westermann
GPG key ID: 9D417FA5BB9D5E1D

View file

@ -56,35 +56,6 @@ fun Route.account() {
+"Aus Wiki importieren"
}
}
if (user.checkPermission(Permission.SCHEDULE)) {
form(action = "$prefix/account/shift", method = FormMethod.post) {
div("form-group") {
label {
htmlFor = "shift"
+"Zeitplan verschieben"
}
input(
name = "shift",
classes = "form-control",
type = InputType.number
) {
id = "shift"
placeholder = "Tage"
value = ""
min = "-1337"
max = "1337"
}
}
div("form-group") {
button(type = ButtonType.submit, classes = "form-btn btn-primary") {
+"Verschieben"
}
}
}
}
}
}
}
@ -552,21 +523,4 @@ fun Route.account() {
call.error(HttpStatusCode.Unauthorized)
}
}
post("/account/shift") {
authenticateOrRedirect(Permission.SCHEDULE) {
val shift = call.request.queryParameters["shift"]?.toIntOrNull() ?: 0
if (shift != 0 && shift in -1337..1337) {
val schedules = ScheduleRepository.all()
for (schedule in schedules) {
ScheduleRepository.update(schedule.copy(day = schedule.day + shift))
}
}
call.respondRedirect("$prefix/account")
}
}
}