Commit graph

2895 commits

Author SHA1 Message Date
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
Pierre de La Morinerie
4bba1f0660 views: add a "None" option to optional radio lists
After clicking on a radio button option, it is impossible to revert to
the "None of the values selected" state.

However on non-mandatory fields, reverting to the no-selection value
should be possible.

To fix this, add an explicit "N/A" option.
2020-08-25 11:42:30 +02:00
Christophe Robillard
090a247ba9 validates phone champ server side 2020-08-20 15:33:03 +02:00
Christophe Robillard
f77cc06a91 prend en compte le nom de l'enseigne pour l'établissement 2020-08-20 14:23:02 +02:00
Pierre de La Morinerie
a7361fdbd3 models: require belong_to associations on mail templates 2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
29e8c43e5e models: require belong_to associations on groupe_instructeur 2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
5a7bd24fba models: require belong_to associations on type_de_champ
- Make `type_de_champ.procedure` a requirement;
- Move the procedure_id assignation to `before_validation` (otherwise
the record is invalid, and never gets saved);
2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
6328011f60 models: require belong_to associations on champ
- Make `champ.dossier` a requirement;
- Move the dossier_id assignation to `before_validation` (otherwise
the record is invalid, and never gets saved);
- Allow specs to only build the champ (instead of saving it to the
database), which bypasses the requirement to have a dossier.
2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
71d9774d58 models: require belong_to associations on trusted_device_token 2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
059c147ffc models: require belong_to associations on service 2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
ce53e219e0 models: require belong_to associations on procedure_presentation
Some tests are still failing
2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
802d3804f5 models: require belong_to associations on invite 2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
fe8804f208 models: require belong_to associations on individual 2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
afb1c33154 models: require belong_to associations on geo_area 2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
aff2713032 models: require belong_to associations on follow 2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
91619b16e8 models: require belong_to associations on feedback 2020-08-18 15:57:36 +02:00
Pierre de La Morinerie
51d392a1dc models: require belong_to associations on dossier 2020-08-18 15:57:36 +02:00
Pierre de La Morinerie
dd1bed9340 models: require belong_to associations on commentaire 2020-08-18 15:57:36 +02:00
Pierre de La Morinerie
32e55a6d37 models: require belong_to associations on avis 2020-08-18 15:57:36 +02:00
Pierre de La Morinerie
aefdd5d2a1 models: require belong_to associations on attestation_template 2020-08-18 15:57:36 +02:00
Pierre de La Morinerie
1ea4c2aa36 models: require belong_to associations on attestation 2020-08-18 15:57:36 +02:00
Pierre de La Morinerie
c1e2928ce7 models: require belong_to associations on assign_to 2020-08-18 15:57:36 +02:00
Pierre de La Morinerie
df2429d7ad factories: build type_de_champ instead of creating them
This allows to minimize the number of actual creations when only a
build is requested.
2020-08-13 17:39:49 +02:00
Pierre de La Morinerie
c8ec5c8846 factories: remove the Rubocop workaround 2020-08-13 17:39:49 +02:00
Judith
bfabd3b6a5 Specs adapted 2020-08-13 13:41:45 +00:00
Christophe Robillard
0b35619322 skip verify authenticity token for helpscout
Co-authored-by: LeSim <mail@simon.lehericey.net>
2020-08-10 17:19:22 +02:00
kara Diaby
9b66c894b2 Adapt configuration email view to the new UI 2020-08-06 16:56:24 +02:00
Pierre de La Morinerie
65809f8ea0 config: flip action_dispatch_return_only_media_type_on_content_type
This makes `ActionDispatch::Controller#content_type` return not only
the MIME type, but also in some circumstances the charset.

Example:

```ruby
reponse.content_type == 'text/html; charset=utf-8'
```

The MIME type-only fragment can now be accessed using `#media_type`.

Changes to the tests are not stricly necessary (because no charset is
present in the actual value), but represent the intent better.
2020-08-05 16:48:36 +02:00
Pierre de La Morinerie
8962db38cc models: render attestations in a simpler way
The older method of instanciating an entire new rendering stack can be
made simpler using Rails >= 5.0 methods.

See https://api.rubyonrails.org/classes/ActionController/Renderer.html#method-i-render
2020-08-04 16:53:46 +02:00
clemkeirua
21221a7c49 fix missing alt 2020-08-04 13:41:10 +00:00
clemkeirua
101acafb65 fix hidden label 2020-08-04 13:41:10 +00:00
clemkeirua
cc9341a83c fix missing header for account creation 2020-08-04 13:41:10 +00:00
jpoulvel
bf94cc021b
Merge pull request #5424 from betagouv/new_design_edit_attestation
New design page admin/attestation_templates/edit
2020-07-31 11:18:22 +02:00
kara Diaby
db3e40ebf8 Fixe la non possibilité de cloner une démarche pour une procédure archivée (nouvelle interface administrateur) 2020-07-30 12:00:43 +02:00
clemkeirua
c772c3454c update dossier after saving champ
update last_champ_updated_at without hook
update last_champ_private_updated_at without hook

Co-authored-by: Christophe Robillard <christophe.robillard@beta.gouv.fr>
2020-07-30 10:18:44 +02:00
Christophe Robillard
b940d2e1b0 update dossier after saving avis
update last_avis_updated_at without hook

Co-authored-by: clemkeirua <clement@keiruaprod.fr>
2020-07-30 10:18:44 +02:00
clemkeirua
f3a675c3bc update dossier after saving commentaire
update last_commentaire_updated_at without hook

Co-authored-by: Christophe Robillard <christophe.robillard@beta.gouv.fr>
2020-07-30 10:18:44 +02:00
jpoulvel
62e04a6ca9
Merge branch 'dev' into new_design_edit_attestation 2020-07-30 09:53:09 +02:00
Kara Diaby
5894a86bd8
Merge pull request #5423 from betagouv/feat/5402
Feat/5402 - [Admin] new UI for procedures listing
2020-07-29 17:38:49 +02:00
clemkeirua
c404f92107 graphql: possibility to filter dossiers by archived 2020-07-29 16:59:34 +02:00
kara Diaby
d4c6e501c6 Ajoute la liste des démarches de l'interface administrateur sur la nouvelle UI 2020-07-29 15:35:52 +02:00
Judith
0075b508a3 adaptation of specs 2020-07-29 13:15:07 +02:00
Judith
b8a49e9012 creation of attachment_upload_helpers and integration in the code 2020-07-29 12:26:27 +02:00
Judith
5df3838173 - tranferred controllers from admin to mew_administrateur
- removed admin/attestation_templates views
- changed routes accordingly
2020-07-29 12:26:27 +02:00
Keirua
347dbe4c87
Merge pull request #5417 from betagouv/cleanup-incident-janvier
Suppression du message d'alerte suite aux problèmes d'upload
2020-07-29 11:00:12 +02:00
Paul Chavard
1fca481c6e Cleanup after clone 2020-07-28 17:04:06 +02:00
clemkeirua
de1df85462 suppression du message d'alerte suite aux problèmes d'upload 2020-07-27 10:32:03 +02:00
LeSim
7f22cc86a9
Merge pull request #5405 from betagouv/set-app-name-as-parameter
Rendre le nom d'application paramètrable
2020-07-24 10:33:54 +02:00
clemkeirua
c91e231347 spec: replace reference to ds in password 2020-07-23 16:20:16 +02:00
Paul Chavard
bb5a90da76 fix active_revision_id -> active_revision.id 2020-07-23 15:07:25 +02:00