Add pool, change design, did stuf

This commit is contained in:
Lars Westermann 2019-06-10 20:00:00 +02:00
parent fd41c3a72e
commit 43e5bac871
Signed by: lars.westermann
GPG key ID: 9D417FA5BB9D5E1D
12 changed files with 141 additions and 16 deletions

View file

@ -13,6 +13,7 @@ data class Room(
val whiteboard: Boolean, val whiteboard: Boolean,
val blackboard: Boolean, val blackboard: Boolean,
val accessible: Boolean, val accessible: Boolean,
val pool: Boolean,
override val createdAt: Long = 0, override val createdAt: Long = 0,
override val updateAt: Long = 0 override val updateAt: Long = 0
) : Model { ) : Model {
@ -23,7 +24,12 @@ data class Room(
mapOf( mapOf(
"name" to name "name" to name
), mapOf( ), mapOf(
"projector" to projector "projector" to projector,
"internet" to internet,
"whiteboard" to whiteboard,
"blackboard" to blackboard,
"accessible" to accessible,
"pool" to pool
), mapOf( ), mapOf(
"places" to places.toDouble() "places" to places.toDouble()
) )
@ -43,6 +49,7 @@ data class Room(
if (whiteboard != other.whiteboard) return false if (whiteboard != other.whiteboard) return false
if (blackboard != other.blackboard) return false if (blackboard != other.blackboard) return false
if (accessible != other.accessible) return false if (accessible != other.accessible) return false
if (pool != other.pool) return false
return true return true
} }
@ -58,6 +65,7 @@ data class Room(
result = 31 * result + whiteboard.hashCode() result = 31 * result + whiteboard.hashCode()
result = 31 * result + blackboard.hashCode() result = 31 * result + blackboard.hashCode()
result = 31 * result + accessible.hashCode() result = 31 * result + accessible.hashCode()
result = 31 * result + pool.hashCode()
return result return result
} }
} }

View file

@ -251,6 +251,7 @@ class CalendarEntry(private val calendar: CalendarBody, view: HTMLElement) : Vie
language = workGroup.language.code language = workGroup.language.code
this.workGroup = workGroup this.workGroup = workGroup
html.removeAttribute("style")
style { style {
val size = workGroup.length / CALENDAR_GRID_WIDTH.toDouble() val size = workGroup.length / CALENDAR_GRID_WIDTH.toDouble()

View file

@ -31,7 +31,7 @@
bottom: 0; bottom: 0;
left: 100%; left: 100%;
margin-left: 1rem; margin-left: 1rem;
border-right: solid 1px var(--table-border-color); border-right: solid 1px var(--input-border-color);
} }
} }
@ -45,19 +45,22 @@
.board-header { .board-header {
height: 8rem !important; height: 8rem !important;
margin-top:0.3rem;
& > div { & > div {
height: 100%; height: 100%;
} }
&:after { &:after {
content: ''; content: "";
position: absolute; position: absolute;
left: 0; left: 0;
width: 100%; width: 100%;
top: 100%; height: 100%;
margin-top: 0.5rem;
border-bottom: solid 1px var(--table-border-color); border-bottom: solid 1px var(--table-border-color);
box-shadow: 0 0 4px black;
top: -1rem;
padding-top: 1.2rem;
} }
} }
@ -112,7 +115,7 @@
} }
.board-schedule-color { .board-schedule-color {
width: 1.2rem; width: 1.5rem;
span { span {
display: block; display: block;

View file

@ -349,6 +349,7 @@
width: 12rem; width: 12rem;
position: relative; position: relative;
padding-left: 0.2rem; padding-left: 0.2rem;
text-align: center;
&::before { &::before {
content: ''; content: '';
@ -638,3 +639,34 @@
display: block; display: block;
} }
} }
.track-legend-list {
display: flex;
line-height: 2rem;
height: 2rem;
width: 100%;
padding: 0 1rem;
}
.track-legend {
flex-basis: 0;
flex-grow: 1;
flex-shrink: 1;
position: relative;
}
.track-legend-color {
width: 1rem;
height: 1rem;
border-radius: 100%;
position: absolute;
left: 0;
top: 0.5rem;
background-color: var(--primary-color);
}
.track-legend-name {
position: absolute;
top: 0;
left: 2rem;
}

View file

@ -22,6 +22,7 @@
th, td { th, td {
padding: 0 0.6rem; padding: 0 0.6rem;
position: relative;
} }
.action { .action {
@ -30,6 +31,7 @@
tr { tr {
border-top: solid 1px var(--table-border-color); border-top: solid 1px var(--table-border-color);
position: relative;
&:first-child { &:first-child {
background-color: var(--table-header-color); background-color: var(--table-header-color);
@ -148,4 +150,13 @@
&.active { &.active {
display: block; display: block;
} }
}
.track-table-color {
width: 1rem;
height: 1rem;
border-radius: 100%;
position: absolute !important;
top: 0.6rem;
left: 6rem;
} }

View file

@ -51,7 +51,7 @@
.calendar-body { .calendar-body {
display: flex; display: flex;
width: calc(100vw - 9.6rem); width: calc(100vw - 8.6rem);
} }
.calendar-row { .calendar-row {
@ -75,6 +75,8 @@
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
width: 100%;
text-align: center;
} }
} }
} }
@ -83,6 +85,8 @@
.calendar-cell { .calendar-cell {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
width: 6rem !important;
text-align: center;
span { span {
padding: 0 0.2rem; padding: 0 0.2rem;

View file

@ -49,6 +49,7 @@ object DbRoom : Table() {
val whiteboard = bool("whiteboard") val whiteboard = bool("whiteboard")
val blackboard = bool("blackboard") val blackboard = bool("blackboard")
val accessible = bool("accessible") val accessible = bool("accessible")
val pool = bool("pool").default(false)
val createdAt = long("createdAt") val createdAt = long("createdAt")
val updatedAt = long("updatedAt") val updatedAt = long("updatedAt")

View file

@ -25,6 +25,7 @@ object RoomRepository : Repository<Room> {
val whiteboard = row[DbRoom.whiteboard] val whiteboard = row[DbRoom.whiteboard]
val blackboard = row[DbRoom.blackboard] val blackboard = row[DbRoom.blackboard]
val accessible = row[DbRoom.accessible] val accessible = row[DbRoom.accessible]
val pool = row[DbRoom.pool]
val createdAt = row[DbRoom.createdAt] val createdAt = row[DbRoom.createdAt]
val updatedAt = row[DbRoom.updatedAt] val updatedAt = row[DbRoom.updatedAt]
@ -38,6 +39,7 @@ object RoomRepository : Repository<Room> {
whiteboard, whiteboard,
blackboard, blackboard,
accessible, accessible,
pool,
createdAt, createdAt,
updatedAt updatedAt
) )
@ -61,6 +63,7 @@ object RoomRepository : Repository<Room> {
it[whiteboard] = model.whiteboard it[whiteboard] = model.whiteboard
it[blackboard] = model.blackboard it[blackboard] = model.blackboard
it[accessible] = model.accessible it[accessible] = model.accessible
it[pool] = model.pool
it[createdAt] = now it[createdAt] = now
it[updatedAt] = now it[updatedAt] = now
}[DbRoom.id] ?: throw IllegalStateException("Cannot create model!") }[DbRoom.id] ?: throw IllegalStateException("Cannot create model!")
@ -85,6 +88,7 @@ object RoomRepository : Repository<Room> {
it[whiteboard] = model.whiteboard it[whiteboard] = model.whiteboard
it[blackboard] = model.blackboard it[blackboard] = model.blackboard
it[accessible] = model.accessible it[accessible] = model.accessible
it[pool] = model.pool
it[updatedAt] = now it[updatedAt] = now
} }

View file

@ -47,12 +47,12 @@ fun Route.account() {
} }
} }
a(href = "/account/backup", classes = "form-btn") { a(href = "$prefix/account/backup", classes = "form-btn") {
+"Sicherung" +"Sicherung"
} }
if (user.checkPermission(Permission.ADMIN)) { if (user.checkPermission(Permission.ADMIN)) {
a(href = "/account/import", classes = "form-btn") { a(href = "$prefix/account/import", classes = "form-btn") {
+"Aus Wiki importieren" +"Aus Wiki importieren"
} }
} }
@ -116,7 +116,7 @@ fun Route.account() {
div("account-import") { div("account-import") {
form( form(
action = "/account/restore", action = "$prefix/account/restore",
method = FormMethod.post, method = FormMethod.post,
encType = FormEncType.multipartFormData encType = FormEncType.multipartFormData
) { ) {

View file

@ -4,13 +4,16 @@ import com.soywiz.klock.*
import com.soywiz.klock.locale.german import com.soywiz.klock.locale.german
import de.kif.backend.Configuration import de.kif.backend.Configuration
import de.kif.backend.isAuthenticated import de.kif.backend.isAuthenticated
import de.kif.backend.prefix
import de.kif.backend.repository.RoomRepository import de.kif.backend.repository.RoomRepository
import de.kif.backend.repository.ScheduleRepository import de.kif.backend.repository.ScheduleRepository
import de.kif.backend.repository.TrackRepository
import de.kif.backend.view.respondMain import de.kif.backend.view.respondMain
import de.kif.common.CALENDAR_GRID_WIDTH import de.kif.common.CALENDAR_GRID_WIDTH
import de.kif.common.model.Permission import de.kif.common.model.Permission
import de.kif.common.model.Room import de.kif.common.model.Room
import de.kif.common.model.Schedule import de.kif.common.model.Schedule
import de.kif.common.model.Track
import io.ktor.application.call import io.ktor.application.call
import io.ktor.response.respondRedirect import io.ktor.response.respondRedirect
import io.ktor.routing.Route import io.ktor.routing.Route
@ -26,7 +29,6 @@ import kotlin.collections.component2
import kotlin.collections.set import kotlin.collections.set
import kotlin.math.max import kotlin.math.max
import kotlin.math.min import kotlin.math.min
import de.kif.backend.prefix
const val MINUTES_OF_DAY = 24 * 60 const val MINUTES_OF_DAY = 24 * 60
@ -150,6 +152,27 @@ fun DIV.renderCalendar(
} }
} }
fun HtmlBlockTag.renderTrackLegend(tracks: List<Track>) {
val list = listOf(null) + tracks
div("track-legend-list") {
for (track in list) {
div("track-legend") {
span("track-legend-color") {
attributes["style"] = CSSBuilder().apply {
val c = track?.color
if (c != null) {
backgroundColor = Color(c.toString())
}
}.toString()
}
span("track-legend-name") {
+(track?.name ?: "Allgemein")
}
}
}
}
}
fun Route.calendar() { fun Route.calendar() {
get("/calendar") { get("/calendar") {
@ -200,6 +223,7 @@ fun Route.calendar() {
*/ */
val rooms = RoomRepository.all() val rooms = RoomRepository.all()
val tracks = TrackRepository.all()
val orientation = call.request.cookies["orientation"]?.let { name -> val orientation = call.request.cookies["orientation"]?.let { name ->
CalendarOrientation.values().find { it.name == name } CalendarOrientation.values().find { it.name == name }
@ -278,6 +302,8 @@ fun Route.calendar() {
} }
} }
renderTrackLegend(tracks)
div("calendar") { div("calendar") {
attributes["data-editable"] = editable.toString() attributes["data-editable"] = editable.toString()

View file

@ -221,6 +221,21 @@ fun Route.room() {
+"Barrierefreier Zugang" +"Barrierefreier Zugang"
} }
} }
div("form-group form-switch") {
input(
name = "pool",
classes = "form-control",
type = InputType.checkBox
) {
id = "pool"
checked = editRoom.pool
}
label {
htmlFor = "pool"
+"PC-Pool"
}
}
} }
div("form-group") { div("form-group") {
@ -259,6 +274,7 @@ fun Route.room() {
params["whiteboard"]?.let { room = room.copy(whiteboard = it == "on") } params["whiteboard"]?.let { room = room.copy(whiteboard = it == "on") }
params["blackboard"]?.let { room = room.copy(blackboard = it == "on") } params["blackboard"]?.let { room = room.copy(blackboard = it == "on") }
params["accessible"]?.let { room = room.copy(accessible = it == "on") } params["accessible"]?.let { room = room.copy(accessible = it == "on") }
params["pool"]?.let { room = room.copy(pool = it == "on") }
RoomRepository.update(room) RoomRepository.update(room)
@ -380,6 +396,21 @@ fun Route.room() {
+"Barrierefreier Zugang" +"Barrierefreier Zugang"
} }
} }
div("form-group form-switch") {
input(
name = "pool",
classes = "form-control",
type = InputType.checkBox
) {
id = "pool"
checked = false
}
label {
htmlFor = "pool"
+"PC-Pool"
}
}
} }
div("form-group") { div("form-group") {
@ -411,8 +442,9 @@ fun Route.room() {
val whiteboard = params["whiteboard"] == "on" val whiteboard = params["whiteboard"] == "on"
val blackboard = params["blackboard"] == "on" val blackboard = params["blackboard"] == "on"
val accessible = params["accessible"] == "on" val accessible = params["accessible"] == "on"
val pool = params["pool"] == "on"
val room = Room(null, name, places, projector, internet, whiteboard, blackboard, accessible) val room = Room(null, name, places, projector, internet, whiteboard, blackboard, accessible, pool)
RoomRepository.create(room) RoomRepository.create(room)

View file

@ -1,9 +1,8 @@
package de.kif.backend.route package de.kif.backend.route
import de.kif.backend.authenticateOrRedirect import de.kif.backend.authenticateOrRedirect
import de.kif.backend.prefix
import de.kif.backend.repository.TrackRepository import de.kif.backend.repository.TrackRepository
import de.kif.backend.view.MainTemplate
import de.kif.backend.view.MenuTemplate
import de.kif.backend.view.TableTemplate import de.kif.backend.view.TableTemplate
import de.kif.backend.view.respondMain import de.kif.backend.view.respondMain
import de.kif.common.Search import de.kif.common.Search
@ -12,7 +11,6 @@ import de.kif.common.model.Permission
import de.kif.common.model.Track import de.kif.common.model.Track
import io.ktor.application.call import io.ktor.application.call
import io.ktor.html.insert import io.ktor.html.insert
import io.ktor.html.respondHtmlTemplate
import io.ktor.request.receiveParameters import io.ktor.request.receiveParameters
import io.ktor.response.respondRedirect import io.ktor.response.respondRedirect
import io.ktor.routing.Route import io.ktor.routing.Route
@ -24,7 +22,6 @@ import kotlinx.css.Display
import kotlinx.html.* import kotlinx.html.*
import kotlin.collections.set import kotlin.collections.set
import kotlin.random.Random import kotlin.random.Random
import de.kif.backend.prefix
fun DIV.colorPicker(color: Color?) { fun DIV.colorPicker(color: Color?) {
val colorString = color?.toString() ?: Color( val colorString = color?.toString() ?: Color(
@ -126,6 +123,12 @@ fun Route.track() {
} }
td { td {
+u.color.toString() +u.color.toString()
span("track-table-color") {
attributes["style"] = CSSBuilder().apply {
backgroundColor = kotlinx.css.Color(u.color.toString())
}.toString()
}
} }
td(classes = "action") { td(classes = "action") {
a("$prefix/track/${u.id}") { a("$prefix/track/${u.id}") {