class UI tweaks

This commit is contained in:
Thibault Duplessis 2020-01-18 09:13:56 -06:00
parent 0e4bb0ec69
commit 04d5dbb7e2
2 changed files with 6 additions and 6 deletions

View file

@ -119,23 +119,23 @@ object clas {
bits.layout("New class", Right("newClass"))(
cls := "box-pad",
h1("New class"),
innerForm(form, routes.Clas.create)
innerForm(form, none)
)
def edit(c: lila.clas.Clas, form: Form[ClasData])(implicit ctx: Context) =
bits.layout(c.name, Left(c withStudents Nil))(
cls := "box-pad",
h1("Edit ", c.name),
innerForm(form, routes.Clas.update(c.id.value))
innerForm(form, c.some)
)
private def innerForm(form: Form[ClasData], url: play.api.mvc.Call)(implicit ctx: Context) =
postForm(cls := "form3", action := url)(
private def innerForm(form: Form[ClasData], clas: Option[Clas])(implicit ctx: Context) =
postForm(cls := "form3", action := clas.fold(routes.Clas.create())(c => routes.Clas.update(c.id.value)))(
form3.globalError(form),
form3.group(form("name"), frag("Class name"))(form3.input(_)(autofocus)),
form3.group(form("desc"), raw("Class description"))(form3.textarea(_)(rows := 5)),
form3.actions(
a(href := routes.Clas.index)(trans.cancel()),
a(href := clas.fold(routes.Clas.index())(c => routes.Clas.show(c.id.value)))(trans.cancel()),
form3.submit(trans.apply())
)
)

View file

@ -144,7 +144,7 @@ object student {
form3.group(
form("realName"),
frag("Real name"),
help = frag("Private info, never visible on Lichess. Helps you remember who that student is.").some
help = frag("Private. Will never be shown to anyone else. Helps you remember who that student is.").some
)(form3.input(_))
def form(