Make it ugly again
This commit is contained in:
parent
c28317aefd
commit
2be6c7c819
2 changed files with 59 additions and 3 deletions
|
@ -981,6 +981,7 @@ form {
|
||||||
.post {
|
.post {
|
||||||
position: relative;
|
position: relative;
|
||||||
padding-top: 2rem;
|
padding-top: 2rem;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.post-name {
|
.post-name {
|
||||||
|
@ -1008,8 +1009,8 @@ form {
|
||||||
}
|
}
|
||||||
|
|
||||||
.post-content {
|
.post-content {
|
||||||
h1, h2, h3, h4, h5, h6 {
|
h1, h2, h3, h4, h5, h6, p {
|
||||||
margin: 0;
|
margin: 0.7rem 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
h1 {
|
h1 {
|
||||||
|
@ -1031,3 +1032,18 @@ form {
|
||||||
font-size: 1rem;
|
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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,7 +10,9 @@ import de.kif.common.model.Permission
|
||||||
import de.kif.common.model.Post
|
import de.kif.common.model.Post
|
||||||
import io.ktor.application.call
|
import io.ktor.application.call
|
||||||
import io.ktor.html.respondHtmlTemplate
|
import io.ktor.html.respondHtmlTemplate
|
||||||
|
import io.ktor.http.HttpStatusCode
|
||||||
import io.ktor.request.receiveParameters
|
import io.ktor.request.receiveParameters
|
||||||
|
import io.ktor.response.respond
|
||||||
import io.ktor.response.respondRedirect
|
import io.ktor.response.respondRedirect
|
||||||
import io.ktor.routing.Route
|
import io.ktor.routing.Route
|
||||||
import io.ktor.routing.get
|
import io.ktor.routing.get
|
||||||
|
@ -43,7 +45,7 @@ fun Route.overview() {
|
||||||
|
|
||||||
for (post in postList) {
|
for (post in postList) {
|
||||||
div("overview-post post") {
|
div("overview-post post") {
|
||||||
span("post-name") {
|
a("/p/${post.url}", classes="post-name") {
|
||||||
+post.name
|
+post.name
|
||||||
}
|
}
|
||||||
if (editable) {
|
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}") {
|
get("/post/{id}") {
|
||||||
authenticateOrRedirect(Permission.POST) { user ->
|
authenticateOrRedirect(Permission.POST) { user ->
|
||||||
|
|
Loading…
Add table
Reference in a new issue