-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Standardise checkbox/toggle UX on a few forms #19046
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Standardise checkbox/toggle UX on a few forms #19046
Conversation
a2edc0c to
b04f32e
Compare
| private def nativeCheckboxField( | ||
| field: Field, | ||
| labelContent: Frag, | ||
| help: Option[Frag], | ||
| half: Boolean, | ||
| value: String = "true" | ||
| ) = | ||
| div( | ||
| cls := List( | ||
| "form-check form-group" -> true, | ||
| "form-half" -> half | ||
| ) | ||
| )( | ||
| div( | ||
| span(cls := "form-check-input")( | ||
| form3.nativeCheckbox( | ||
| form3.id(field), | ||
| field.name, | ||
| checked = field.value.has("true"), | ||
| value = value | ||
| ) | ||
| ), | ||
| label(`for` := form3.id(field))(labelContent) | ||
| ), | ||
| help.map(small(cls := "form-help")(_)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you probably want to extract this as form3 helper to be able to use it for gameUI.scala for example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it! That makes sense, that would reduce code duplication. I will do that in the upcoming revision.
| help = frag("Include this round when calculating players' rating changes").some | ||
| "Rated round", | ||
| help = frag("Include this round when calculating players' rating changes").some, | ||
| half = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
half = true on purpose here?
| label(`for` := form3.id(field))(labelContent) | ||
| ), | ||
| help.map(small(cls := "form-help")(_)) | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hasn't that moved to Form3.scala?
| raw( | ||
| "Prevent reopening the account later. If you check this box, even administrators will be unable to reopen your account at your request." | ||
| ) | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couldn't this use nativeCheckboxField
Related to #17396
This PR standardises checkbox vs toggle switch UX on a subset of pages, following the guideline that instant apply settings should use toggle switches, while submit/save flows should use checkboxes.
Pages updated
Notes
Testing
sbt test