Add pool, change design, did stuf
This commit is contained in:
parent
fd41c3a72e
commit
43e5bac871
12 changed files with 141 additions and 16 deletions
|
@ -13,6 +13,7 @@ data class Room(
|
|||
val whiteboard: Boolean,
|
||||
val blackboard: Boolean,
|
||||
val accessible: Boolean,
|
||||
val pool: Boolean,
|
||||
override val createdAt: Long = 0,
|
||||
override val updateAt: Long = 0
|
||||
) : Model {
|
||||
|
@ -23,7 +24,12 @@ data class Room(
|
|||
mapOf(
|
||||
"name" to name
|
||||
), mapOf(
|
||||
"projector" to projector
|
||||
"projector" to projector,
|
||||
"internet" to internet,
|
||||
"whiteboard" to whiteboard,
|
||||
"blackboard" to blackboard,
|
||||
"accessible" to accessible,
|
||||
"pool" to pool
|
||||
), mapOf(
|
||||
"places" to places.toDouble()
|
||||
)
|
||||
|
@ -43,6 +49,7 @@ data class Room(
|
|||
if (whiteboard != other.whiteboard) return false
|
||||
if (blackboard != other.blackboard) return false
|
||||
if (accessible != other.accessible) return false
|
||||
if (pool != other.pool) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
@ -58,6 +65,7 @@ data class Room(
|
|||
result = 31 * result + whiteboard.hashCode()
|
||||
result = 31 * result + blackboard.hashCode()
|
||||
result = 31 * result + accessible.hashCode()
|
||||
result = 31 * result + pool.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
|
|
@ -251,6 +251,7 @@ class CalendarEntry(private val calendar: CalendarBody, view: HTMLElement) : Vie
|
|||
language = workGroup.language.code
|
||||
this.workGroup = workGroup
|
||||
|
||||
html.removeAttribute("style")
|
||||
style {
|
||||
val size = workGroup.length / CALENDAR_GRID_WIDTH.toDouble()
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
bottom: 0;
|
||||
left: 100%;
|
||||
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 {
|
||||
height: 8rem !important;
|
||||
margin-top:0.3rem;
|
||||
|
||||
& > div {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
&:after {
|
||||
content: '';
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
top: 100%;
|
||||
margin-top: 0.5rem;
|
||||
height: 100%;
|
||||
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 {
|
||||
width: 1.2rem;
|
||||
width: 1.5rem;
|
||||
|
||||
span {
|
||||
display: block;
|
||||
|
|
|
@ -349,6 +349,7 @@
|
|||
width: 12rem;
|
||||
position: relative;
|
||||
padding-left: 0.2rem;
|
||||
text-align: center;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
|
@ -638,3 +639,34 @@
|
|||
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;
|
||||
}
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
th, td {
|
||||
padding: 0 0.6rem;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.action {
|
||||
|
@ -30,6 +31,7 @@
|
|||
|
||||
tr {
|
||||
border-top: solid 1px var(--table-border-color);
|
||||
position: relative;
|
||||
|
||||
&:first-child {
|
||||
background-color: var(--table-header-color);
|
||||
|
@ -148,4 +150,13 @@
|
|||
&.active {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.track-table-color {
|
||||
width: 1rem;
|
||||
height: 1rem;
|
||||
border-radius: 100%;
|
||||
position: absolute !important;
|
||||
top: 0.6rem;
|
||||
left: 6rem;
|
||||
}
|
|
@ -51,7 +51,7 @@
|
|||
|
||||
.calendar-body {
|
||||
display: flex;
|
||||
width: calc(100vw - 9.6rem);
|
||||
width: calc(100vw - 8.6rem);
|
||||
}
|
||||
|
||||
.calendar-row {
|
||||
|
@ -75,6 +75,8 @@
|
|||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -83,6 +85,8 @@
|
|||
.calendar-cell {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
width: 6rem !important;
|
||||
text-align: center;
|
||||
|
||||
span {
|
||||
padding: 0 0.2rem;
|
||||
|
|
|
@ -49,6 +49,7 @@ object DbRoom : Table() {
|
|||
val whiteboard = bool("whiteboard")
|
||||
val blackboard = bool("blackboard")
|
||||
val accessible = bool("accessible")
|
||||
val pool = bool("pool").default(false)
|
||||
|
||||
val createdAt = long("createdAt")
|
||||
val updatedAt = long("updatedAt")
|
||||
|
|
|
@ -25,6 +25,7 @@ object RoomRepository : Repository<Room> {
|
|||
val whiteboard = row[DbRoom.whiteboard]
|
||||
val blackboard = row[DbRoom.blackboard]
|
||||
val accessible = row[DbRoom.accessible]
|
||||
val pool = row[DbRoom.pool]
|
||||
|
||||
val createdAt = row[DbRoom.createdAt]
|
||||
val updatedAt = row[DbRoom.updatedAt]
|
||||
|
@ -38,6 +39,7 @@ object RoomRepository : Repository<Room> {
|
|||
whiteboard,
|
||||
blackboard,
|
||||
accessible,
|
||||
pool,
|
||||
createdAt,
|
||||
updatedAt
|
||||
)
|
||||
|
@ -61,6 +63,7 @@ object RoomRepository : Repository<Room> {
|
|||
it[whiteboard] = model.whiteboard
|
||||
it[blackboard] = model.blackboard
|
||||
it[accessible] = model.accessible
|
||||
it[pool] = model.pool
|
||||
it[createdAt] = now
|
||||
it[updatedAt] = now
|
||||
}[DbRoom.id] ?: throw IllegalStateException("Cannot create model!")
|
||||
|
@ -85,6 +88,7 @@ object RoomRepository : Repository<Room> {
|
|||
it[whiteboard] = model.whiteboard
|
||||
it[blackboard] = model.blackboard
|
||||
it[accessible] = model.accessible
|
||||
it[pool] = model.pool
|
||||
it[updatedAt] = now
|
||||
}
|
||||
|
||||
|
|
|
@ -47,12 +47,12 @@ fun Route.account() {
|
|||
}
|
||||
}
|
||||
|
||||
a(href = "/account/backup", classes = "form-btn") {
|
||||
a(href = "$prefix/account/backup", classes = "form-btn") {
|
||||
+"Sicherung"
|
||||
}
|
||||
|
||||
if (user.checkPermission(Permission.ADMIN)) {
|
||||
a(href = "/account/import", classes = "form-btn") {
|
||||
a(href = "$prefix/account/import", classes = "form-btn") {
|
||||
+"Aus Wiki importieren"
|
||||
}
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ fun Route.account() {
|
|||
|
||||
div("account-import") {
|
||||
form(
|
||||
action = "/account/restore",
|
||||
action = "$prefix/account/restore",
|
||||
method = FormMethod.post,
|
||||
encType = FormEncType.multipartFormData
|
||||
) {
|
||||
|
|
|
@ -4,13 +4,16 @@ import com.soywiz.klock.*
|
|||
import com.soywiz.klock.locale.german
|
||||
import de.kif.backend.Configuration
|
||||
import de.kif.backend.isAuthenticated
|
||||
import de.kif.backend.prefix
|
||||
import de.kif.backend.repository.RoomRepository
|
||||
import de.kif.backend.repository.ScheduleRepository
|
||||
import de.kif.backend.repository.TrackRepository
|
||||
import de.kif.backend.view.respondMain
|
||||
import de.kif.common.CALENDAR_GRID_WIDTH
|
||||
import de.kif.common.model.Permission
|
||||
import de.kif.common.model.Room
|
||||
import de.kif.common.model.Schedule
|
||||
import de.kif.common.model.Track
|
||||
import io.ktor.application.call
|
||||
import io.ktor.response.respondRedirect
|
||||
import io.ktor.routing.Route
|
||||
|
@ -26,7 +29,6 @@ import kotlin.collections.component2
|
|||
import kotlin.collections.set
|
||||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
import de.kif.backend.prefix
|
||||
|
||||
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() {
|
||||
|
||||
get("/calendar") {
|
||||
|
@ -200,6 +223,7 @@ fun Route.calendar() {
|
|||
*/
|
||||
|
||||
val rooms = RoomRepository.all()
|
||||
val tracks = TrackRepository.all()
|
||||
|
||||
val orientation = call.request.cookies["orientation"]?.let { name ->
|
||||
CalendarOrientation.values().find { it.name == name }
|
||||
|
@ -278,6 +302,8 @@ fun Route.calendar() {
|
|||
}
|
||||
}
|
||||
|
||||
renderTrackLegend(tracks)
|
||||
|
||||
div("calendar") {
|
||||
attributes["data-editable"] = editable.toString()
|
||||
|
||||
|
|
|
@ -221,6 +221,21 @@ fun Route.room() {
|
|||
+"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") {
|
||||
|
@ -259,6 +274,7 @@ fun Route.room() {
|
|||
params["whiteboard"]?.let { room = room.copy(whiteboard = it == "on") }
|
||||
params["blackboard"]?.let { room = room.copy(blackboard = it == "on") }
|
||||
params["accessible"]?.let { room = room.copy(accessible = it == "on") }
|
||||
params["pool"]?.let { room = room.copy(pool = it == "on") }
|
||||
|
||||
RoomRepository.update(room)
|
||||
|
||||
|
@ -380,6 +396,21 @@ fun Route.room() {
|
|||
+"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") {
|
||||
|
@ -411,8 +442,9 @@ fun Route.room() {
|
|||
val whiteboard = params["whiteboard"] == "on"
|
||||
val blackboard = params["blackboard"] == "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)
|
||||
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
package de.kif.backend.route
|
||||
|
||||
import de.kif.backend.authenticateOrRedirect
|
||||
import de.kif.backend.prefix
|
||||
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.respondMain
|
||||
import de.kif.common.Search
|
||||
|
@ -12,7 +11,6 @@ import de.kif.common.model.Permission
|
|||
import de.kif.common.model.Track
|
||||
import io.ktor.application.call
|
||||
import io.ktor.html.insert
|
||||
import io.ktor.html.respondHtmlTemplate
|
||||
import io.ktor.request.receiveParameters
|
||||
import io.ktor.response.respondRedirect
|
||||
import io.ktor.routing.Route
|
||||
|
@ -24,7 +22,6 @@ import kotlinx.css.Display
|
|||
import kotlinx.html.*
|
||||
import kotlin.collections.set
|
||||
import kotlin.random.Random
|
||||
import de.kif.backend.prefix
|
||||
|
||||
fun DIV.colorPicker(color: Color?) {
|
||||
val colorString = color?.toString() ?: Color(
|
||||
|
@ -126,6 +123,12 @@ fun Route.track() {
|
|||
}
|
||||
td {
|
||||
+u.color.toString()
|
||||
|
||||
span("track-table-color") {
|
||||
attributes["style"] = CSSBuilder().apply {
|
||||
backgroundColor = kotlinx.css.Color(u.color.toString())
|
||||
}.toString()
|
||||
}
|
||||
}
|
||||
td(classes = "action") {
|
||||
a("$prefix/track/${u.id}") {
|
||||
|
|
Loading…
Reference in a new issue