Skip to content
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

Improve feedback in forms #7471

Closed
wants to merge 4 commits into from
Closed

Improve feedback in forms #7471

wants to merge 4 commits into from

Conversation

Ana06
Copy link
Member

@Ana06 Ana06 commented Apr 25, 2019

Add html5_validators gem, which provides automatic client-side validation using HTML5 based on the models validations. This makes much easier to keep views and backend code consistent and
provide early feedback to users. This is also changing many forms in the whole application. It should be though a save change as it is consistent with our model validations and the errors would have just been shown later.

I have removed from our views code SOME of the html validations that are now provided by HTML5Validators, by using our models validations. There may still be some repetition and differences but I had to stop somewhere. In the future when realizing of the discrepancies, it should be as easy as remove the view code. Some more PR for more validation improvements are coming.

I have also change some emails fields to use email_field Rails helper, which generates a text_field of type email, providing feedback to users when introducing a wrong email without sending the form.

It helps addressing #7011.

@Ana06 Ana06 added Frontend Things related to the OBS RoR app Bootstrap 🚀 Bootstrap migration labels Apr 25, 2019
@Ana06
Copy link
Member Author

Ana06 commented Apr 30, 2019

Ana06 added 4 commits May 13, 2019 17:04
Enable automatic client-side validation using HTML5 based on the models
validations.

This makes much easier to keep views and backend code consistent and
provide early feedback to users.
Remove from our views code SOME of the html validations that are now
provided by HTML5Validators, by using our models validations.
`email_field` generates a `text_field` of type `email`, providing
feedback to users when introducing a wrong email without sending the
form.
Spider tests fails otherwise and we plan to throw away this code anyway
(old UI).
@coolo
Copy link
Member

coolo commented May 21, 2019

And once again, the spider test uncovers crucial tests missing:

[979faece-c1e5-4d78-ac39-0b73b12863c4] [299:68.43] ActionView::Template::Error (undefined method `auto_html5_validation' for Patchinfo:Class):
[979faece-c1e5-4d78-ac39-0b73b12863c4] [299:68.43]     11:             %strong
[979faece-c1e5-4d78-ac39-0b73b12863c4]     12:               = f.label(:packager, 'Packager:')
[979faece-c1e5-4d78-ac39-0b73b12863c4]     13:             %br/
[979faece-c1e5-4d78-ac39-0b73b12863c4]     14:             = f.text_field :packager, required: true
[979faece-c1e5-4d78-ac39-0b73b12863c4]     15:             :javascript
[979faece-c1e5-4d78-ac39-0b73b12863c4]     16:               $("#packager").autocomplete({source: '#{url_for controller: 'user', action: 'autocomplete'}', search: function(event, ui) {
[979faece-c1e5-4d78-ac39-0b73b12863c4]     17:                 $(this).addClass('loading-spinner');
[979faece-c1e5-4d78-ac39-0b73b12863c4] [299:68.43]   
[979faece-c1e5-4d78-ac39-0b73b12863c4] [299:68.43] app/views/webui/patchinfo/_form.html.haml:14:in `block in _app_views_webui_patchinfo__form_html_haml__1383717022713791384_47354342968160'
[979faece-c1e5-4d78-ac39-0b73b12863c4] app/views/webui/patchinfo/_form.html.haml:2:in `_app_views_webui_patchinfo__form_html_haml__1383717022713791384_47354342968160'
[979faece-c1e5-4d78-ac39-0b73b12863c4] app/views/webui/patchinfo/edit.html.haml:3:in `_app_views_webui_patchinfo_edit_html_haml__1907723402339578054_47354343006520'
[979faece-c1e5-4d78-ac39-0b73b12863c4] config/initializers/wrap_parameters.rb:38:in `call'
[979faece-c1e5-4d78-ac39-0b73b12863c4] test/functional/webui/spider_test.rb:99:in `crawl'
[979faece-c1e5-4d78-ac39-0b73b12863c4] test/functional/webui/spider_test.rb:161:in `test_spider_as_admin'
[979faece-c1e5-4d78-ac39-0b73b12863c4] test/test_helper.rb:118:in `block in __run'
[979faece-c1e5-4d78-ac39-0b73b12863c4] test/test_helper.rb:118:in `map'
[979faece-c1e5-4d78-ac39-0b73b12863c4] test/test_helper.rb:118:in `__run'
[299:68.67]   �[1m�[35m (0.3ms)�[0m  �[1m�[31mROLLBACK�[0m

@Ana06
Copy link
Member Author

Ana06 commented Jul 5, 2019

I don't think I'll have time to finish this in the close feature. I still think it is a nice gem that could help us keeping OBS consistent. It may require a bit of work on the gem though. If someone would like to finish, feel free 😉

@Ana06 Ana06 closed this Jul 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bootstrap 🚀 Bootstrap migration Frontend Things related to the OBS RoR app
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants