-
-
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
Open
nkc-137
wants to merge
13
commits into
lichess-org:master
Choose a base branch
from
nkc-137:ux-checkbox-toggle-standardisation
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
52dba67
Close account: standardise checkbox/toggle UX
nkc-137 1d24bdd
Advanced search: standardise checkbox/toggle UX
nkc-137 a02941f
Game import: standardise checkbox/toggle UX
nkc-137 36a74ea
Arena new tournament creation: standardise checkbox/toggle UX
nkc-137 c398db8
Swiss tournament creation: standardise checkbox/toggle UX
nkc-137 b04f32e
Broadcast creation: standardise checkbox/toggle UX
nkc-137 008494e
Extract nativeCheckboxField into Form3 and reuse
nkc-137 a3610a9
Fix minor formatting error
nkc-137 2f86c13
Merge branch 'master' into ux-checkbox-toggle-standardisation
ornicar 17a05e3
remove unnecessary form-help wrapper
ornicar dbf11dc
remove new hardcoded form field values
ornicar d4ef601
remove new unused import
ornicar 9496041
Merge branch 'master' into ux-checkbox-toggle-standardisation
ornicar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| package lila.relay | ||
| package ui | ||
|
|
||
| import play.api.data.Form | ||
| import play.api.data.{ Field, Form } | ||
| import lila.ui.* | ||
| import lila.ui.ScalatagsTemplate.{ given, * } | ||
| import lila.core.study.Visibility | ||
|
|
@@ -320,7 +320,7 @@ final class RelayFormUi(helpers: Helpers, ui: RelayUi, pageMenu: RelayMenuUi): | |
| help = trb.startDateHelp().some, | ||
| half = true | ||
| )(form3.flatpickr(_, local = true, minDate = None)), | ||
| form3.checkbox( | ||
| form3.nativeCheckboxField( | ||
| form("startsAfterPrevious"), | ||
| "When the previous round completes", | ||
| help = frag( | ||
|
|
@@ -379,10 +379,11 @@ Hanna Marie ; Kozul, Zdenko"""), | |
| form3.group(form("rated"), raw("")): field => | ||
| val withDefault = | ||
| if nav.newRound && field.value.isEmpty then field.copy(value = "true".some) else field | ||
| form3.checkbox( | ||
| form3.nativeCheckboxField( | ||
| withDefault, | ||
| labelContent = frag("Rated round"), | ||
| 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 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| ) | ||
| ), | ||
| Color.all.map: color => | ||
|
|
@@ -587,19 +588,21 @@ Hanna Marie ; Kozul, Zdenko"""), | |
| .some | ||
| )( | ||
| form3.split( | ||
| form3.checkbox( | ||
| form3.nativeCheckboxField( | ||
| form("showScores"), | ||
| trb.showScores(), | ||
| help = None, | ||
| half = true | ||
| ), | ||
| form3.checkbox( | ||
| form3.nativeCheckboxField( | ||
| form("showRatingDiffs"), | ||
| "Show player's rating diffs", | ||
| help = None, | ||
| half = true | ||
| ) | ||
| ), | ||
| form3.split( | ||
| form3.checkbox( | ||
| form3.nativeCheckboxField( | ||
| form("teamTable"), | ||
| trans.team.teamTournament(), | ||
| help = frag("Show a team leaderboard. Requires WhiteTeam and BlackTeam PGN tags.").some, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -162,33 +162,60 @@ final class TournamentForm(val helpers: Helpers, showUi: TournamentShow)( | |
| ) | ||
| ) | ||
|
|
||
| private def nativeCheckboxField( | ||
| field: Field, | ||
| labelContent: Frag, | ||
| help: Option[Frag], | ||
| half: Boolean = false, | ||
| 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")(_)) | ||
| ) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hasn't that moved to Form3.scala? |
||
|
|
||
| def featuresFields(form: Form[?])(using ctx: Context)(using FormPrefix) = | ||
| form3.fieldset("Features", toggle = false.some)( | ||
| form3.split( | ||
| form3.checkbox( | ||
| form.prefix("berserkable"), | ||
| nativeCheckboxField( | ||
| form("berserkable"), | ||
| trans.arena.allowBerserk(), | ||
| help = trans.arena.allowBerserkHelp().some, | ||
| half = true | ||
| ), | ||
| form3.hiddenFalse(form.prefix("berserkable")), | ||
| form3.checkbox( | ||
| form.prefix("streakable"), | ||
| nativeCheckboxField( | ||
| form("streakable"), | ||
| trans.arena.arenaStreaks(), | ||
| help = trans.arena.arenaStreaksHelp().some, | ||
| half = true | ||
| ), | ||
| form3.hiddenFalse(form.prefix("streakable")) | ||
| ), | ||
| form3.split( | ||
| form3.checkbox( | ||
| form.prefix("rated"), | ||
| nativeCheckboxField( | ||
| form("rated"), | ||
| trans.site.rated(), | ||
| help = trans.site.ratedFormHelp().some | ||
| ), | ||
| form3.hiddenFalse(form.prefix("rated")), | ||
| form3.checkbox( | ||
| form.prefix("hasChat"), | ||
| nativeCheckboxField( | ||
| form("hasChat"), | ||
| trans.site.chatRoom(), | ||
| help = trans.arena.allowChatHelp().some, | ||
| half = true | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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