Commit graph

11391 commits

Author SHA1 Message Date
Pierre de La Morinerie
2057a08d97
Merge pull request #5511 from betagouv/dev 2020-08-27 17:41:27 +02:00
Pierre de La Morinerie
cce8271d68
Merge pull request #5510 from betagouv/locate-with-ff 2020-08-27 17:15:17 +02:00
Pierre de La Morinerie
0dbe56cb78 gems: add http_accept_language to Gemfile.lock 2020-08-27 17:14:42 +02:00
Pierre de La Morinerie
dab76a05ac
Merge pull request #5509 from betagouv/dev 2020-08-27 16:38:14 +02:00
Pierre de La Morinerie
7118fc88aa
Merge pull request #5504 from betagouv/locate-with-ff
Localisation : quand le feature-flag `localization` est activé, la langue par défaut est choisie en fonction des préférences exprimées par le navigateur
2020-08-27 16:27:44 +02:00
Judith
af25fdd77c gem http_accept_language installed and (de)activable with feature flag 2020-08-27 16:15:01 +02:00
Pierre de La Morinerie
ea16e71a8d
Merge pull request #5505 from betagouv/add-database-schema-vizualisation
docs: ajout d'un schéma de la base de données en PDF
2020-08-27 16:09:57 +02:00
Pierre de La Morinerie
1767df33b0 doc: add a visualization of the database models
Re-generate the schema using `bin/rake erd`.

NB: there's a way to update the PDF automatically after each migration.
But it requires `graphviz` to be installed locally, which I'm not
sure I want to require by default.
2020-08-27 12:02:28 +02:00
Pierre de La Morinerie
0570692d4a
Merge pull request #5489 from betagouv/allow-deselecting-all-checkbox-items
Usager : correction d'un problème où décocher toutes les cases d'une liste n'enregistrait pas les changements
2020-08-27 11:30:10 +02:00
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
f15b96cb3a
Merge pull request #5500 from betagouv/contact-page-EN
Mise en place de l'infrastructure de localisation de la page `/contact`
2020-08-27 11:13:25 +02:00
Judith
bfa4231f5e date and number formats changed according to rails-I18n locale 2020-08-27 11:03:34 +02:00
Judith
2f0953692c Internationalization of the Contact page in FR and EN 2020-08-27 11:03:34 +02:00
Paul Chavard
abd4e3c6cc
Merge pull request #5503 from betagouv/move-virus-scan-to-attachment
config: remove comment about ActiveStorage integration with VirusScanner
2020-08-27 09:29:24 +01:00
Pierre de La Morinerie
82c89fb56f config: remove comment about ActiveStorage integration with VirusScanner
As the comment states, it would be nice to load the Virus Scanner on
the Attachment (rather than the blob).

However, in order not to clobber the blob metadata, we want to run the
VirusScanner once the blob analyzer did run.

And the most direct way to detect that the blob analyzer did run is to
add an `on_update_commit` hook on the blob, as this hook will be
trigerred when saving changes to the metadata. This is what the current
solution uses. 

So the current solution is almost optimal, and has a low chance of
accidentally clobbering the blob metadata – as the virus scanner is only
started when the analysis phase is finished.
2020-08-26 16:11:01 +02:00
Pierre de La Morinerie
23be513b4f
Merge pull request #5502 from betagouv/dev 2020-08-26 10:21:09 +02:00
Pierre de La Morinerie
71d362c2fb
Merge pull request #5499 from betagouv/dependabot/npm_and_yarn/highcharts-8.1.1
build(deps): bump highcharts from 8.1.0 to 8.1.1
2020-08-25 17:58:56 +02:00
dependabot[bot]
cb2be72f45
build(deps): bump highcharts from 8.1.0 to 8.1.1
Bumps [highcharts](https://github.com/highcharts/highcharts-dist) from 8.1.0 to 8.1.1.
- [Release notes](https://github.com/highcharts/highcharts-dist/releases)
- [Commits](https://github.com/highcharts/highcharts-dist/compare/v8.1.0...v8.1.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-08-25 14:05:52 +00:00
Pierre de La Morinerie
8b82bf3b88
Merge pull request #5497 from betagouv/fix-autosave-error
Usager : correction d'erreurs lors de l'enregistrement automatique d'un dossier en brouillon après la suppression d'un bloc répétable
2020-08-25 15:54:49 +02:00
Pierre de La Morinerie
3fdecf0924 helpers: remove element immediately when no timeout is specified
This fixes an issue where clicking quickly on several "Remove row"
buttons on a repetition field results in autosave errors.

This is because the N+1 autosave request is correctly sent after the
Nth response from the server, but _before_ the row element is actually
removed from the DOM. So the N+1 request actually sends the fields for
the deleted row, which makes the server raise an error.

With this fix, the row gets properly removed when the server responds,
and before the next request is started.
2020-08-25 15:45:49 +02:00
Pierre de La Morinerie
ecc4f01c20 autosave: trigger an autosave after removing a row 2020-08-25 15:45:49 +02:00
Pierre de La Morinerie
96037069ff autosave: remove the repetition row after deletion
Before, when autosaving a draft, removing a repetition row would
send `_destroy` inputs to the controller – but not remove the row
from the DOM. This led to the `_destroy` inputs being sent again
on the next autosave request, which made the controller raise
(because the row fields were already deleted before).

To fix this, we let the controller response remove the deleted
row(s) from the DOM.

Doing it using a controller response avoids the need to keep track
of operations on the Javascript side: the controller can easily
know which row was just deleted, and emit the relevant changes for
the DOM. This keeps the autosave requests robust: even if a request
is skipped (e.g. because of a network interruption), the next request
will still contain the relevant informations to succeed, and not let the
form in an unstable state.

Fix #5470
2020-08-25 14:39:34 +02:00
Pierre de La Morinerie
e157a289e1 autosave: factorize some javascript code 2020-08-25 14:39:34 +02:00
Pierre de La Morinerie
a3dd81a89f
Merge pull request #5496 from betagouv/add-health-keywords-to-dubious-procedures
Super-admin : ajout de termes médicaux au détecteur automatique de données sensibles
2020-08-25 14:16:47 +02:00
Pierre de La Morinerie
3c91cfc83c jobs: add health-related keywords to dubious procedures scanner
We are not certified for hosting health-related data yet.
2020-08-25 12:04:10 +00:00
Pierre de La Morinerie
d2feb53532
Merge pull request #5488 from betagouv/allow-deselecting-optional-radio-buttons
Usager : un champ radio optionnel peut maintenant être dé-sélectionné
2020-08-25 12:46:24 +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
Pierre de La Morinerie
50f61ee37b views: remove "Select a value" text on radio lists
This text:

- Isn't present on other form controls
- Should only be displayed if the field is mandatory anyway
2020-08-25 11:42:30 +02:00
krichtof
770765c4f0
Merge pull request #5494 from betagouv/dev
2020-08-20-01
2020-08-20 16:08:57 +02:00
krichtof
2df7408547
Merge pull request #5490 from betagouv/5416-valid-phone
renforce la validation des numéros de téléphone
2020-08-20 15:42:30 +02:00
Christophe Robillard
abe62398b6 very light client-side validation for phone 2020-08-20 15:33:03 +02:00
Christophe Robillard
090a247ba9 validates phone champ server side 2020-08-20 15:33:03 +02:00
krichtof
7faae3a438
Merge pull request #5492 from betagouv/5491-right-name-for-etablissement
prend en compte le nom de l'enseigne pour l'établissement
2020-08-20 15:29:36 +02:00
Christophe Robillard
f77cc06a91 prend en compte le nom de l'enseigne pour l'établissement 2020-08-20 14:23:02 +02:00
jpoulvel
0a5a5ef317
Merge pull request #5487 from betagouv/remove-autofocus-login
Sign-in page: autofocus on 'input: password' removed
2020-08-19 16:44:26 +02:00
Judith
74cff31876 autofocus on 'input: password' removed according to accessibility audit requirements. No change noticed 2020-08-19 14:35:34 +00:00
jpoulvel
018b57b58d
Merge pull request #5469 from betagouv/placeholder-date
Date champs: adding a placeholder for IE and Safari
2020-08-19 16:26:53 +02:00
Judith
206646f765 date champs: adding a placeholder for IE and Safari (which do not support the input type date) 2020-08-19 14:10:58 +00:00
Pierre de La Morinerie
be0e71c6c2
Merge pull request #5398 from betagouv/belongs-to-required-by-default
Rails : les relations `belongs_to` sont maintenant requises par défaut. (Pour une relation optionnelle, mentionner explicitement `belongs_to :table, optional: true`)
2020-08-18 17:43:32 +02:00
Pierre de La Morinerie
d77efec7a0 config: enable active_record.belongs_to_required_by_default 2020-08-18 15:57:37 +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
eb22dc9d8f models: require belong_to associations on module_api_carto 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
d807700c7b models: require belong_to associations on traitement 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