demarches-normaliennes/spec/views
Pierre de La Morinerie 0800bf68d0 views: allow unselecting all values from a multiple dropdown
Currently, deselecting all values from a multiple dropdown rendered as
checkboxes doesn't have any effect when submitting the form (the
previous values are still there, instead of being deselected).

This is because unchecked checkboxes are not sent by the browser – so
the "empty selection" never gets sent.

Rails `form.check_box` usually works around this by inserting an empty
hidden checkbox element, that will be sent even if all others are
de-selected. But the documentation warns that this is not possible when
iterating over an array (rather than a model). Which is our case here.

To fix this, this commit uses `collection_check_boxes` instead. It will
insert the proper hidden checkboxes in all cases, and fix our use case.

See https://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#method-i-collection_check_boxes
2020-08-27 11:13:40 +02:00
..
admin Move admin/assigns to the new UI like groupe_instructeurs 2020-06-29 14:44:28 +02:00
commencer specs: always require rails_helper 2020-03-31 12:48:32 +02:00
instructeur Instructeur : add overview table with counts for files 2020-07-02 09:02:49 +00:00
instructeur_mailer Changed the routes to pass all new design admin pages under 2020-07-07 14:08:01 +00:00
layouts specs: always require rails_helper 2020-03-31 12:48:32 +02:00
new_administrateur/procedures specs: use fixture_file_upload rather than Rack::Test::UploadedFile 2020-07-01 11:13:45 +02:00
shared views: allow unselecting all values from a multiple dropdown 2020-08-27 11:13:40 +02:00
users display only etablissement infos 2020-05-20 11:09:54 +02:00