autofill broadcast livechesscloud source round

pull/8795/head
Thibault Duplessis 2021-04-28 08:56:27 +02:00
parent d0b4e19da9
commit ee71c6f77e
4 changed files with 11 additions and 11 deletions

View File

@ -61,7 +61,7 @@ trait FormHelper { self: I18nHelper =>
klass: String = "",
half: Boolean = false,
help: Option[Frag] = None
)(content: Field => Frag)(implicit ctx: Context): Frag =
)(content: Field => Frag)(implicit ctx: Context): Tag =
div(
cls := List(
"form-group" -> true,

View File

@ -58,7 +58,8 @@ object roundForm {
main(cls := "page-small box box-pad")(body)
)
private def inner(form: Form[Data], url: play.api.mvc.Call, t: RelayTour)(implicit ctx: Context) =
private def inner(form: Form[Data], url: play.api.mvc.Call, t: RelayTour)(implicit ctx: Context) = {
val isLcc = form("syncUrl").value.exists(LccRegex.matches)
postForm(cls := "form3", action := url)(
div(cls := "form-group")(
bits.howToUse,
@ -77,11 +78,10 @@ object roundForm {
gameIdsHelp()
).some
)(form3.input(_)),
form("syncUrl").value.exists(LccRegex.matches) option {
form3.group(form("syncUrlRound"), roundNumber())(
form3.input(_, typ = "number")(required := true)
)
},
form3
.group(form("syncUrlRound"), roundNumber(), help = frag("Only for livechesscloud source URLs").some)(
form3.input(_, typ = "number")(required := isLcc)
)(ctx)(cls := (!isLcc).option("none")),
form3.split(
form3.group(
form("startsAt"),
@ -102,4 +102,5 @@ object roundForm {
form3.submit(trans.apply())
)
)
}
}

View File

@ -114,11 +114,10 @@ object form {
)
),
form3.split(
teams.nonEmpty ?? {
teams.nonEmpty option
form3.group(form("team"), raw("Only members of team"), half = true)(
form3.select(_, List(("", "No Restriction")) ::: teams.map(_.pair))
)
},
),
form3.group(
form("position"),
trans.startPosition(),

View File

@ -35,7 +35,7 @@ final class RelayRoundForm {
s"Maximum rounds per tournament: ${RelayTour.maxRelays}",
_ => trs.rounds.sizeIs < RelayTour.maxRelays
)
}.fill(Data(name = s"Round ${trs.rounds.size + 1}"))
}.fill(Data(name = s"Round ${trs.rounds.size + 1}", syncUrlRound = Some(trs.rounds.size + 1)))
def edit(r: RelayRound) = Form(roundMapping) fill Data.make(r)
}