-
Notifications
You must be signed in to change notification settings - Fork 194
Improve usability of create game form #11568
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?
Conversation
Fixes tobymao#11071. Now selects number input field value on focus. Also added min and max player info to the labels.
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.
@garrettngarcia Thanks for looking into this highly annoying bug. However, I don't think that this is the correct way to fix this one.
The problem, as far as I understand it, is that we've got some over-zealous validation code. If you delete the player count from one of the boxes it sees the blank as zero, which is less than the minimum player could. So it helpfully re-populates the box with the minimum player count.
This needs to be redone so that the blank doesn't trigger adding the minimum player count. And we'd probably need to make sure that the form isn't submitted with an invalid player count – I think this validation code was added to prevent games being created with invalid counts.
@ollybh I see. I had it that way in an earlier version, but didn't want games to be created with invalid min and max so came up with the selection solution. I can change it back. Where should this form validation be done? In JS or in the back end? Can you point me to some current validation logic to get me started? |
Ideally both. There does appear to already be some front end validation: 18xx/assets/app/view/create_game.rb Lines 418 to 421 in 4fa1406
I'm not sure how much back end validation there is. It might go in Lines 437 to 442 in 4fa1406
…but the default implementation of Line 130 in 4fa1406
|
Fixes #11071
Before clicking "Create"
master
pins
orarchive_alpha_games
label if this change will break existing gamesdocker compose exec rack rubocop -a
docker compose exec rack rake
Implementation Notes
Explanation of Change
Now selects number input field value on focus. Also added min and max player info to the form labels.
Tested on Safari and Chrome on iOS and Mac.
Screenshots
Any Assumptions / Hacks