user blogging WIP

ublog
Thibault Duplessis 2021-08-31 11:54:09 +02:00
parent 4fa765d44d
commit 9e51a31646
3 changed files with 8 additions and 11 deletions

View File

@ -52,7 +52,7 @@ final class Ublog(env: Env) extends LilaController(env) {
err => BadRequest(html.ublog.form.create(me, err)).fuccess,
data =>
env.ublog.api.create(data, me) map { post =>
Redirect(urlOf(post)).flashSuccess
Redirect(editUrlOf(post)).flashSuccess
}
)
}

View File

@ -33,9 +33,6 @@ object form {
) {
main(cls := "box box-pad page ublog-post-form")(
h1("Edit your blog post"),
div(cls := "ublog-post-form__publish")(
p(if (post.live) "This post is published" else "This is a draft")
),
imageForm(user, post),
inner(user, f, post.some)
)
@ -68,6 +65,13 @@ object form {
)
)(
form3.globalError(form),
post.isDefined option form3.checkbox(
form("live"),
raw("Publish on your blog"),
help = raw(
"If checked, the post will be listed on your blog. If not, it will be private, in your draft posts"
).some
),
form3.group(form("title"), "Post title")(form3.input(_)(autofocus)),
form3.group(form("intro"), "Post intro")(form3.input(_)(autofocus)),
form3.group(
@ -75,10 +79,6 @@ object form {
"Post body",
help = markdownAvailable.some
)(form3.textarea(_)(rows := 30)),
form3.checkbox(
form("live"),
raw("Publish this post on your blog")
),
form3.actions(
a(href := post.fold(routes.Ublog.index(user.username))(views.html.ublog.post.urlOf))(trans.cancel()),
form3.submit(trans.apply())

View File

@ -1,7 +1,4 @@
.ublog-post-form {
&__publish {
margin: 3vh 0;
}
.ublog-post-image {
max-width: 100%;
}