Make it ugly again

This commit is contained in:
Lars Westermann 2019-05-24 17:11:19 +02:00
parent c28317aefd
commit 2be6c7c819
Signed by: lars.westermann
GPG key ID: 9D417FA5BB9D5E1D
2 changed files with 59 additions and 3 deletions

View file

@ -981,6 +981,7 @@ form {
.post {
position: relative;
padding-top: 2rem;
width: 100%;
}
.post-name {
@ -1008,8 +1009,8 @@ form {
}
.post-content {
h1, h2, h3, h4, h5, h6 {
margin: 0;
h1, h2, h3, h4, h5, h6, p {
margin: 0.7rem 0;
padding: 0;
}
h1 {
@ -1030,4 +1031,19 @@ form {
h6 {
font-size: 1rem;
}
}
.overview-post {
max-height: 20rem;
overflow: hidden;
&::after {
content: '';
position: absolute;
display: block;
height: 1.5rem;
top: 18.5rem;
width: 100%;
background: linear-gradient(0deg, $background-primary-color, transparent);
}
}

View file

@ -10,7 +10,9 @@ import de.kif.common.model.Permission
import de.kif.common.model.Post
import io.ktor.application.call
import io.ktor.html.respondHtmlTemplate
import io.ktor.http.HttpStatusCode
import io.ktor.request.receiveParameters
import io.ktor.response.respond
import io.ktor.response.respondRedirect
import io.ktor.routing.Route
import io.ktor.routing.get
@ -43,7 +45,7 @@ fun Route.overview() {
for (post in postList) {
div("overview-post post") {
span("post-name") {
a("/p/${post.url}", classes="post-name") {
+post.name
}
if (editable) {
@ -89,6 +91,44 @@ fun Route.overview() {
}
}
get("/p/{url}") {
val user = isAuthenticated(Permission.POST)
val editable = user != null
val post = PostRepository.getByUrl(call.parameters["url"] ?: "")
if (post == null) {
call.respond(HttpStatusCode.NotFound, "Not found")
return@get
}
call.respondHtmlTemplate(MainTemplate()) {
menuTemplate {
this.user = user
active = MenuTemplate.Tab.BOARD
}
content {
div("overview") {
div("post") {
span("post-name") {
+post.name
}
if (editable) {
a("/post/${post.id}", classes = "post-edit") {
i("material-icons") { +"edit" }
}
}
div("post-content") {
unsafe {
raw(markdownToHtml(post.content))
}
}
}
}
}
}
}
get("/post/{id}") {
authenticateOrRedirect(Permission.POST) { user ->