redesign all user forms

pull/2218/head
Thibault Duplessis 2016-08-27 14:32:17 +02:00
parent 1a46d5c1c0
commit 2721271f02
19 changed files with 115 additions and 187 deletions

View File

@ -11,7 +11,7 @@
</p>
<form action="@routes.Account.closeConfirm" method="POST">
<ul>
@account.passwdFormField(form("passwd"), trans.password.str())
@account.passwdFormField(form("passwd"), trans.password())
<li>@errMsg(form)</li>
<li>
<button type="submit" class="submit button">@trans.closeYourAccount()</button>

View File

@ -2,10 +2,6 @@
@title = @{ s"${u.username} - ${trans.changeEmail.str()}" }
@evenMoreCss = {
@cssTag("user-form.css")
}
@account.layout(title = title, active = "email") {
<div class="content_box small_box">
<div class="signup_box">
@ -26,7 +22,7 @@
<label for="@form("email").id">@trans.email()</label>
<input type="email" value="@form("email").value" name="@form("email").name" id="@form("email").id" />
</li>
@account.passwdFormField(form("passwd"), trans.password.str())
@account.passwdFormField(form("passwd"), trans.password())
<li>@errMsg(form)</li>
<li>
<button type="submit" class="submit button" data-icon="E">

View File

@ -1,8 +1,8 @@
@(title: String, active: String)(body: Html)(implicit ctx: Context)
@(title: String, active: String, evenMoreCss: Html = Html(""))(body: Html)(implicit ctx: Context)
@moreCss = {
@cssTag("user-form.css")
@cssTag("account.css")
@evenMoreCss
}
@moreJs = {
@jsTag("user.js")

View File

@ -2,11 +2,7 @@
@title = @{ s"${u.username} - ${trans.changePassword.str()}" }
@evenMoreCss = {
@cssTag("user-form.css")
}
@account.layout(title = title, active = "password") {
@account.layout(title = title, active = "password", evenMoreCss = cssTag("material.form.css")) {
<div class="content_box small_box">
<div class="signup_box">
<h1 class="lichess_title">
@ -16,20 +12,12 @@
case false => {<span class="is-red" data-icon="L"></span>}
}
</h1>
<form action="@routes.Account.passwdApply" method="POST">
<ul>
@account.passwdFormField(form("oldPasswd"), trans.currentPassword.str())
@account.passwdFormField(form("newPasswd1"), trans.newPassword.str())
@account.passwdFormField(form("newPasswd2"), trans.newPasswordAgain.str())
<li>
@errMsg(form)
</li>
<li>
<button type="submit" class="submit button" data-icon="E">
@trans.apply()
</button>
</li>
</ul>
<form class="material form" action="@routes.Account.passwdApply" method="POST">
@passwdFormField(form("oldPasswd"), trans.currentPassword())
@passwdFormField(form("newPasswd1"), trans.newPassword())
@passwdFormField(form("newPasswd2"), trans.newPasswordAgain())
@errMsg(form)
@base.form.submit()
</form>
</div>
</div>

View File

@ -1,13 +1,7 @@
@(field: Field, label: String)(implicit ctx: Context)
@(field: Field, name: Html)(implicit ctx: Context)
<li class="field">
<label for="@field.id">@label</label>
<input
class="passwd"
type="password"
required="required"
name="@field.name"
id="@field.id"
value="@field.value"/>
@errMsg(field)
</li>
@base.form.group(field, name) {
<input class="passwd" type="password" required="required"
name="@field.name" value="@field.value"/>
@errMsg(field)
}

View File

@ -2,55 +2,44 @@
@title = @{ s"${u.username} - ${trans.editProfile.str()}" }
@evenMoreCss = {
@cssTag("user-form.css")
}
@account.layout(title = title, active = "editProfile") {
@account.layout(
title = title,
active = "editProfile",
evenMoreCss =cssTag("material.form.css")) {
<div class="content_box small_box">
<div class="signup_box">
<h1 class="lichess_title">@trans.editProfile()</h1>
<p>@trans.allInformationIsPublicAndOptional()</p>
<form action="@routes.Account.profileApply" method="POST">
<ul>
<li class="field">
<label for="@form("country").id">@trans.country()</label>
@base.select(form("country"), lila.user.Countries.all, default = "".some)
</li>
@NotForKids {
<li class="field">
<label for="@form("location").id">@trans.location()</label>
@base.input(form("location"))
<p class="help">@trans.yourCityRegionOrDepartment()</p>
</li>
<li class="field">
<label for="@form("bio").id">@trans.biography()</label>
<textarea name="@form("bio").name" id="@form("bio").id" cols="25" rows="7">@form("bio").value</textarea>
<p class="help">@trans.biographyDescription()</p>
<p class="help">@trans.maximumNbCharacters(400)</p>
</li>
<li class="field">
<label for="@form("firstName").id">@trans.firstName()</label>
@base.input(form("firstName"))
</li>
<li class="field">
<label for="@form("lastName").id">@trans.lastName()</label>
@base.input(form("lastName"))
</li>
<h1 class="lichess_title text" data-icon="*">@trans.editProfile()</h1>
<p class="pre_form_help">@trans.allInformationIsPublicAndOptional()</p>
<form class="material form" action="@routes.Account.profileApply" method="POST">
<div>
@base.form.group(form("country"), trans.country(), klass = "half") {
@base.select(form("country"), lila.user.Countries.all, default = "".some)
}
<li class="field">
<label for="@form("fideRating").id">FIDE rating</label>
@base.input(form("fideRating"))
</li>
<li>
@errMsg(form)
</li>
<li>
<button type="submit" class="submit button" data-icon="E">
@trans.apply()
</button>
</li>
</ul>
@base.form.group(form("location"), trans.location(), klass = "half") {
@base.input(form("location"))
}
</div>
@NotForKids {
@base.form.group(form("bio"), Html(s"${trans.biography.str()}")) {
<textarea name="@form("bio").name" id="@form("bio").id" rows=5 maxlength=600>@form("bio").value</textarea>
<p class="form-help">@trans.biographyDescription()</p>
}
<div>
@base.form.group(form("firstName"), trans.firstName(), klass = "half") {
@base.input(form("firstName"))
}
@base.form.group(form("lastName"), trans.lastName(), klass = "half") {
@base.input(form("lastName"))
}
</div>
}
<div>
@base.form.group(form("fideRating"), Html("FIDE rating"), klass = "half") {
@base.input(form("fideRating"), typ="number")
}
</div>
@errMsg(form)
@base.form.submit()
</form>
</div>
</div>

View File

@ -2,10 +2,6 @@
@title = @{ s"${u.username} - ${trans.changePassword.str()}" }
@evenMoreCss = {
@cssTag("user-form.css")
}
@auth.layout(title = title, zen = true) {
<div class="content_box small_box">
<div class="signup_box">
@ -19,8 +15,8 @@
<form action="@routes.Auth.passwordResetConfirmApply(token)" method="POST">
<input type="hidden" name="@form("token").name" value="@form("token").value" />
<ul>
@account.passwdFormField(form("newPasswd1"), trans.newPassword.str())
@account.passwdFormField(form("newPasswd2"), trans.newPasswordAgain.str())
@account.passwdFormField(form("newPasswd1"), trans.newPassword())
@account.passwdFormField(form("newPasswd2"), trans.newPasswordAgain())
<li>
@errMsg(form)
</li>

View File

@ -0,0 +1,7 @@
@(field: play.api.data.Field, name: Html, klass: String = "", half: Boolean = false, help: Option[Html] = None)(html: Html)(implicit ctx: Context)
<div class="form-group@if(field.hasErrors){ has-error}@if(half){ half}@if(help.isDefined){ margin-bottom} @klass">
@html
@help.map { h => <p class="form-help">@h</p> }
<label for="@field.id" class="control-label">@name</label>
<i class="bar"></i>
</div>

View File

@ -0,0 +1,4 @@
@()(implicit ctx: Context)
<div class="button-container">
<button type="submit" class="submit button text" data-icon="E">@trans.apply()</button>
</div>

View File

@ -1,5 +1,5 @@
@(field: play.api.data.Field, placeholder: Option[String] = None)
@(field: play.api.data.Field, placeholder: Option[String] = None, typ: String = "text")
<input @placeholder.map { p =>
placeholder="@p"
} type="text" value="@field.value" name="@field.name" id="@field.id" />
} type="@typ" value="@field.value" name="@field.name" id="@field.id" />

View File

@ -2,16 +2,8 @@
@import play.api.data.Field
@group(field: Field, name: Html, half: Boolean = false, largeLabel: Boolean = false)(html: Html) = {
<div class="form-group@if(half){ half}@if(field.hasErrors){ has-error}@if(largeLabel){ large-label}">
@html
<label for="@field.id" class="control-label">@name</label>
<i class="bar"></i>
</div>
}
@textarea(field: Field, name: Html) = {
@group(field, name, largeLabel = true) {
@textarea(field: Field, name: Html, help: Option[Html] = None) = {
@base.form.group(field, name, half = false, help = help) {
<textarea name="@field.name" id="@field.id">@field.value</textarea>
}
}
@ -33,25 +25,23 @@ evenMoreCss = Some(cssTag("material.form.css"))) {
}
<form class="content_box_content material form" action="@routes.Coach.edit" method="POST">
<div>
@group(form("enabledByUser"), Html("Published in lichess coaches list"), half = true) {
@base.form.group(form("enabledByUser"), Html("Published in lichess coaches list"), half = true) {
@base.select(form("enabledByUser"), booleanChoices)
}
@group(form("available"), Html("Currently available for lessons"), half = true) {
@base.form.group(form("available"), Html("Currently available for lessons"), half = true) {
@base.select(form("available"), booleanChoices)
}
</div>
@group(form("profile.headline"), Html("Short and inspiring headline")) {
@base.form.group(form("profile.headline"), Html("Short and inspiring headline")) {
@base.input(form("profile.headline"))
}
@textarea(form("profile.description"), Html("Who are you? <em>age, profession, country... let your students know you</em>"))
@textarea(form("profile.playingExperience"), Html("Playing experience <em>tournaments played, best wins, other achievements</em>"))
@textarea(form("profile.teachingExperience"), Html("Teaching experience <em>diplomas, years of practice, best student results</em>"))
@textarea(form("profile.otherExperience"), Html("Other experiences <em>e.g. as chess commentator, or teaching other domains</em>"))
@textarea(form("profile.description"), Html("Who are you?"), help = Html("age, profession, country... let your students know you").some)
@textarea(form("profile.playingExperience"), Html("Playing experience"), help = Html("tournaments played, best wins, other achievements").some)
@textarea(form("profile.teachingExperience"), Html("Teaching experience"), help = Html("diplomas, years of practice, best student results").some)
@textarea(form("profile.otherExperience"), Html("Other experiences"), help = Html("e.g. as chess commentator, or teaching other domains").some)
@textarea(form("profile.skills"), Html("Best skills in chess and teaching"))
@textarea(form("profile.methodology"), Html("Teaching methodology <em>How you prepare and run lessons. How you follow up with students.</em>"))
<div class="button-container">
<button type="submit" class="submit button text" data-icon="E">Save now</button>
</div>
@textarea(form("profile.methodology"), Html("Teaching methodology"), help = Html("How you prepare and run lessons. How you follow up with students.").some)
@base.form.submit()
</form>
</div>
}

View File

@ -1,42 +1,32 @@
@(form: Form[_])(implicit ctx: Context)
@group(field: play.api.data.Field, name: Html, half: Boolean = false)(html: Html) = {
<div class="form-group@if(half){ half}@if(field.hasErrors){ has-error}">
@html
<label for="@field.id" class="control-label">@name</label>
<i class="bar"></i>
</div>
}
@group(form("startsAt"), Html("Start date <strong>UTC</strong>"), half = true) {
@base.form.group(form("startsAt"), Html("Start date <strong>UTC</strong>"), half = true) {
@base.flatpickr(form("startsAt"))
}
@group(form("finishesAt"), Html("End date <strong>UTC</strong>"), half = true) {
@base.form.group(form("finishesAt"), Html("End date <strong>UTC</strong>"), half = true) {
@base.flatpickr(form("finishesAt"))
}
@group(form("title"), Html("Short title")) {
@base.form.group(form("title"), Html("Short title")) {
@base.input(form("title"))
}
@group(form("headline"), Html("Short headline")) {
@base.form.group(form("headline"), Html("Short headline")) {
@base.input(form("headline"))
}
@defining(form("description")) { field =>
@group(field, Html("Possibly long description")) {
@base.form.group(field, Html("Possibly long description")) {
<textarea name="@field.name" id="@field.id">@field.value</textarea>
}
}
@group(form("url"), Html("External URL")) {
@base.form.group(form("url"), Html("External URL")) {
@base.input(form("url"))
}
<div>
@group(form("enabled"), Html("Enabled"), half = true) {
@base.form.group(form("enabled"), Html("Enabled"), half = true) {
@base.select(form("enabled"), booleanChoices)
}
@group(form("homepageHours"), Html("Hours on homepage (0 to 24)"), half = true) {
@base.form.group(form("homepageHours"), Html("Hours on homepage (0 to 24)"), half = true) {
@base.input(form("homepageHours"))
}
</div>
<div class="button-container">
<button type="submit" class="submit button text" data-icon="E">Apply now</button>
</div>
@base.form.submit()

View File

@ -5,70 +5,60 @@
@import lila.tournament.Condition
@import lila.rating.PerfType
@group(field: play.api.data.Field, name: Html, half: Boolean = false)(html: Html) = {
<div class="form-group@if(half){ half}@if(field.hasErrors){ has-error}">
@html
<label for="@field.id" class="control-label">@name</label>
<i class="bar"></i>
</div>
}
<div>
@group(form("date"), Html("Start date <strong>UTC</strong>"), half = true) {
@base.form.group(form("date"), Html("Start date <strong>UTC</strong>"), half = true) {
@base.flatpickr(form("date"))
}
@group(form("name"), Html("Name"), half = true) {
@base.form.group(form("name"), Html("Name"), half = true) {
@base.input(form("name"))
}
</div>
<div>
@group(form("homepageHours"), Html("Hours on homepage (0 to 24)"), half = true) {
@base.form.group(form("homepageHours"), Html("Hours on homepage (0 to 24)"), half = true) {
@base.input(form("homepageHours"))
}
@group(form("image"), Html("Custom icon"), half = true) {
@base.form.group(form("image"), Html("Custom icon"), half = true) {
@base.select(form("image"), imageChoices)
}
</div>
@group(form("headline"), Html("Homepage headline")) {
@base.form.group(form("headline"), Html("Homepage headline")) {
@base.input(form("headline"))
}
@group(form("description"), Html("Full description")) {
@base.form.group(form("description"), Html("Full description")) {
<textarea name="@form("description").name" id="@form("description").id">@form("description").value</textarea>
}
<div>
@group(form("variant"), Html("Variant"), half = true) {
@base.form.group(form("variant"), Html("Variant"), half = true) {
@base.select(form("variant"), translatedVariantChoicesWithVariants.map(x => x._1 -> x._2))
}
@group(form("minutes"), Html("Duration in minutes"), half = true) {
@base.form.group(form("minutes"), Html("Duration in minutes"), half = true) {
@base.input(form("minutes"))
}
</div>
<div>
@group(form("clockTime"), Html("Clock time"), half = true) {
@base.form.group(form("clockTime"), Html("Clock time"), half = true) {
@base.select(form("clockTime"), clockTimeChoices)
}
@group(form("clockIncrement"), Html("Clock increment"), half = true) {
@base.form.group(form("clockIncrement"), Html("Clock increment"), half = true) {
@base.select(form("clockIncrement"), clockIncrementChoices)
}
</div>
<h2>Conditions of entry</h2>
<div>
@group(form("conditions.nbRatedGame.nb"), Html("Minimum rated games"), half = true) {
@base.form.group(form("conditions.nbRatedGame.nb"), Html("Minimum rated games"), half = true) {
@base.select(form("conditions.nbRatedGame.nb"), Condition.DataForm.nbRatedGameChoices)
}
@group(form("conditions.nbRatedGame.perf"), Html("In variant"), half = true) {
@base.form.group(form("conditions.nbRatedGame.perf"), Html("In variant"), half = true) {
@base.select(form("conditions.nbRatedGame.perf"), ("", "Any") :: Condition.DataForm.perfChoices)
}
</div>
<div>
@group(form("conditions.maxRating.rating"), Html("Maximum top rating"), half = true) {
@base.form.group(form("conditions.maxRating.rating"), Html("Maximum top rating"), half = true) {
@base.select(form("conditions.maxRating.rating"), Condition.DataForm.maxRatingChoices)
}
@group(form("conditions.maxRating.perf"), Html("In variant"), half = true) {
@base.form.group(form("conditions.maxRating.perf"), Html("In variant"), half = true) {
@base.select(form("conditions.maxRating.perf"), Condition.DataForm.perfChoices)
}
</div>
<div class="button-container">
<button type="submit" class="submit button text" data-icon="E">Apply now</button>
</div>
@base.form.submit()

View File

@ -12,7 +12,7 @@ object DataForm {
val profile = Form(mapping(
"country" -> optional(nonEmptyText.verifying(Countries.codeSet contains _)),
"location" -> optional(nonEmptyText(maxLength = 80)),
"bio" -> optional(nonEmptyText(maxLength = 400)),
"bio" -> optional(nonEmptyText(maxLength = 600)),
"firstName" -> nameField,
"lastName" -> nameField,
"fideRating" -> optional(number(min = 600, max = 2900))

View File

@ -1,20 +1,6 @@
.coach_edit .material.form {
margin: 30px 20px 20px 20px;
}
.coach_edit .material.form .form-group textarea {
height: 8em;
}
.coach_edit .material.form .form-group.large-label {
margin-top: 4.25rem;
}
.coach_edit .material.form .form-group.large-label .control-label {
opacity: 0.8!important;
top: -2rem!important;
}
.coach_edit .material.form .form-group.large-label .control-label em {
opacity: 0.8;
display: block;
}
.coach_edit .upload_picture {
text-align: center;

View File

@ -31,9 +31,6 @@ table.slist time {
font-size: 0.8em;
opacity: 0.8;
}
.material.form {
margin: 30px 20px 20px 20px;
}
.material.form button {
font-size: 1.7em;
font-weight: normal;

View File

@ -1,3 +1,6 @@
.material.form {
margin: 30px 20px 20px 20px;
}
.material.form * {
box-sizing: border-box;
}
@ -23,7 +26,10 @@
.material.form .form-radio,
.material.form .form-group {
position: relative;
margin-bottom: 3.25rem;
margin-bottom: 3.5rem;
}
.material.form .form-group.margin-bottom {
margin-bottom: 4.5rem;
}
.material.form .form-group.half {
@ -160,8 +166,7 @@ body.dark .material.form .form-group select option {
outline: none;
}
.material.form .form-group *:focus ~ .control-label,
.material.form .form-group *:focus ~ .control-label strong,
.material.form .form-group *:focus ~ .control-label em {
.material.form .form-group *:focus ~ .form-help {
color: #3893E8;
}
.material.form .form-group *:focus ~ .bar::before {

View File

@ -31,9 +31,6 @@ table.slist time {
font-size: 0.8em;
opacity: 0.8;
}
.material.form {
margin: 30px 20px 20px 20px;
}
.material.form button {
font-size: 1.7em;
font-weight: normal;

View File

@ -14,11 +14,6 @@
text-align: right;
width: 150px;
}
.content_box form button.submit {
margin-left: 160px;
padding: 3px 1em;
font-size: 1.1em;
}
form .error {
color: red;
margin-left: 160px;
@ -28,6 +23,10 @@ form .help {
margin-left: 160px;
}
.pre_form_help {
margin-bottom: 40px;
}
div.content_box.prefs fieldset {
margin: 30px 0;
border: 1px #ccc solid;