V2 von Brett her

This commit is contained in:
Lars Westermann 2019-06-08 19:39:45 +02:00
parent 2b29093086
commit 743e57395a
Signed by: lars.westermann
GPG key ID: 9D417FA5BB9D5E1D
7 changed files with 109 additions and 109 deletions

1
.gitignore vendored
View file

@ -9,4 +9,3 @@ data/
*.swo *.swo
*.db *.db
twitter.toml

View file

@ -7,3 +7,6 @@ reference = "2019-06-06"
[general] [general]
wiki_url = "https://wiki.kif.rocks/w/index.php?title=KIF470:Arbeitskreise&action=raw" wiki_url = "https://wiki.kif.rocks/w/index.php?title=KIF470:Arbeitskreise&action=raw"
[twitter]
timeline = "https://twitter.com/kiforbiter?ref_src=twsrc%5Etfw"

View file

@ -28,18 +28,15 @@
padding: 0 0.4rem; padding: 0 0.4rem;
&:nth-child(1) { &:nth-child(1) {
flex-grow: 4; flex-grow: 5;
padding-left: 0.15rem;
padding-right: 0.15rem;
} }
&:nth-child(2) { &:nth-child(2) {
flex-grow: 3; flex-grow: 4;
} }
&:nth-child(3) { &:nth-child(3) {
flex-grow: 3; flex-grow: 4;
} }
} }
} }
@ -66,59 +63,53 @@
} }
.board-schedule-box { .board-schedule-box {
display: flex; margin-bottom: 0.5rem;
flex-wrap: wrap; padding: 1rem;
padding-bottom: 0.5rem;
table {
border-collapse: collapse;
}
}
.board-card-header {
font-family: 'Montserrat', sans-serif;
font-weight: 600;
line-height: 1.5rem;
} }
.board-schedule { .board-schedule {
position: relative; line-height: 1.3rem;
flex-grow: 1; height: 2rem;
flex-basis: 0;
min-width: 15rem;
padding: 0.6rem;
margin: 0 0.25rem 0.5rem;
&:not(:last-child) { &:not(:last-child) {
border-bottom: solid 1px var(--table-border-color) border-bottom: solid 1px var(--table-border-color)
} }
} }
.board-schedule-bottom { .board-schedule-color {
display: block; width: 1.2rem;
padding-left: 1rem;
padding-right: 0.5rem;
line-height: 1rem;
clear: both;
& > span { span {
display: block;
&:first-child { background-color: var(--primary-color);
float: left; width: 0.8rem;
} height: 0.8rem;
&:last-child { border-radius: 100%;
float: right; margin-top: 0.1rem;
}
} }
} }
.board-schedule-color { .board-schedule-time {
background-color: var(--primary-color); width: 7rem;
position: absolute; color: var(--text-secondary-color)
top: 1.25rem;
left: 0.6rem;
width: 0.8rem;
height: 0.8rem;
border-radius: 100%;
} }
.board-schedule-name { .board-schedule-name {
display: block; }
padding-left: 1rem;
line-height: 1.3rem;
font-family: 'Montserrat', sans-serif; .board-schedule-room {
font-weight: 600; width: 4rem;
padding-top: 0.35rem; text-align: right;
padding-bottom: 0.35rem; color: var(--text-secondary-color)
} }

View file

@ -97,6 +97,7 @@ a {
display: block; display: block;
position: relative; position: relative;
padding-left: 2.5rem; padding-left: 2.5rem;
width: 8rem;
&::after { &::after {
content: ''; content: '';

View file

@ -9,9 +9,7 @@ import io.ktor.routing.Route
import io.ktor.routing.get import io.ktor.routing.get
import kotlinx.css.CSSBuilder import kotlinx.css.CSSBuilder
import kotlinx.css.Color import kotlinx.css.Color
import kotlinx.html.div import kotlinx.html.*
import kotlinx.html.span
import kotlinx.html.unsafe
import java.util.* import java.util.*
fun Route.board() { fun Route.board() {
@ -26,16 +24,6 @@ fun Route.board() {
respondMain(true, true) { theme -> respondMain(true, true) { theme ->
content { content {
/*
div("board-header") {
div {
+"KIF 47.0"
}
div("board-header-date") {
+formatDateTime(Date().time)
}
}
*/
div("board") { div("board") {
div("board-schedules") { div("board-schedules") {
attributes["data-reference"] = referenceTime.toString() attributes["data-reference"] = referenceTime.toString()
@ -44,50 +32,24 @@ fun Route.board() {
+"AKs" +"AKs"
} }
div("board-schedule-box") { div("board-card board-schedule-box") {
div("board-card-header") {
+"Running"
}
table {
for ((schedule, time) in scheduleList) { for ((schedule, time) in scheduleList) {
div("board-card board-schedule") { createBoardSchedule(schedule, time)
attributes["data-id"] = schedule.id.toString() }
}
}
span("board-schedule-color") { div("board-card board-schedule-box") {
attributes["style"] = CSSBuilder().apply { div("board-card-header") {
val c = schedule.workGroup.track?.color +"Upcoming"
if (c != null) { }
backgroundColor = Color(c.toString()) table {
} for ((schedule, time) in scheduleList) {
}.toString() createBoardSchedule(schedule, time)
}
span("board-schedule-name") {
+schedule.workGroup.name
}
div("board-schedule-bottom") {
span("board-schedule-time") {
attributes["data-time"] = time.toString()
attributes["data-duration"] = schedule.workGroup.length.toString()
val startTime = (time % MINUTES_OF_DAY).let {
if (it < 0) it + MINUTES_OF_DAY else it
}
val sm = (startTime % 60).toString().padStart(2, '0')
val sh = (startTime / 60).toString().padStart(2, '0')
val startTimeString = "$sh:$sm"
val endTime = ((time + schedule.workGroup.length) % MINUTES_OF_DAY).let {
if (it < 0) it + MINUTES_OF_DAY else it
}
val em = (endTime % 60).toString().padStart(2, '0')
val eh = (endTime / 60).toString().padStart(2, '0')
val endTimeString = "$eh:$em"
+"$startTimeString - $endTimeString"
}
span("board-schedule-room") {
+schedule.room.name
}
}
} }
} }
} }
@ -108,8 +70,7 @@ fun Route.board() {
} }
div("board-card") { div("board-card") {
unsafe { unsafe {
raw( raw("""
"""
<a <a
class="twitter-timeline" class="twitter-timeline"
href="${Configuration.Twitter.timeline}" href="${Configuration.Twitter.timeline}"
@ -119,10 +80,9 @@ fun Route.board() {
data-cards="hidden" data-cards="hidden"
data-lang="de" data-lang="de"
data-dnt="true" data-dnt="true"
>Tweets by kiforbiter</a> >Twitter wall</a>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
""".trimIndent() """.trimIndent())
)
} }
} }
} }
@ -131,3 +91,50 @@ fun Route.board() {
} }
} }
} }
private fun TABLE.createBoardSchedule(schedule: Schedule, time: Int) {
tr("board-schedule") {
attributes["data-id"] = schedule.id.toString()
td("board-schedule-color") {
span {
attributes["style"] = CSSBuilder().apply {
val c = schedule.workGroup.track?.color
if (c != null) {
backgroundColor = Color(c.toString())
}
}.toString()
}
}
td("board-schedule-time") {
attributes["data-time"] = time.toString()
attributes["data-duration"] = schedule.workGroup.length.toString()
val startTime = (time % MINUTES_OF_DAY).let {
if (it < 0) it + MINUTES_OF_DAY else it
}
val sm = (startTime % 60).toString().padStart(2, '0')
val sh = (startTime / 60).toString().padStart(2, '0')
val startTimeString = "$sh:$sm"
val endTime = ((time + schedule.workGroup.length) % MINUTES_OF_DAY).let {
if (it < 0) it + MINUTES_OF_DAY else it
}
val em = (endTime % 60).toString().padStart(2, '0')
val eh = (endTime / 60).toString().padStart(2, '0')
val endTimeString = "$eh:$em"
+"$startTimeString - $endTimeString"
}
td("board-schedule-name") {
+schedule.workGroup.name
}
td("board-schedule-room") {
+schedule.room.name
}
}
}

View file

@ -105,7 +105,7 @@ fun Route.overview() {
data-cards="hidden" data-cards="hidden"
data-lang="de" data-lang="de"
data-dnt="true" data-dnt="true"
>Tweets by kiforbiter</a> >Twitter wall</a>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
""".trimIndent()) """.trimIndent())
} }

View file

@ -9,7 +9,7 @@ uploads = "data/uploads"
database = "data/portal.db" database = "data/portal.db"
[schedule] [schedule]
reference = "2019-03-27" reference = "1970-01-01"
[security] [security]
session_name = "SESSION" session_name = "SESSION"
@ -20,5 +20,4 @@ allowed_upload_extensions = "png, jpg, jpeg"
wiki_url = "" wiki_url = ""
[twitter] [twitter]
username = "" timeline = ""
password = ""