Commit graph

101 commits

Author SHA1 Message Date
Paul Chavard
95d61c85e1 Dispatch events from geo areas list view 2020-06-09 18:45:45 +02:00
Paul Chavard
901b6e23a8 Remove legacy carto 2020-06-04 16:03:23 +02:00
Pierre de La Morinerie
bbc0aa5465 javascript: remove debug code for FileReader errors 2020-05-14 13:29:54 +02:00
Pierre de La Morinerie
86357b65f0 javascript: ignore most common upload errors 2020-05-14 13:29:54 +02:00
Pierre de La Morinerie
4b288038d3 javascript: human-readable message for reading errors during upload 2020-05-14 13:29:54 +02:00
Pierre de La Morinerie
b5f1d97629 app: disable Turbolinks
Fix #5039
2020-05-13 11:04:16 +02:00
Paul Chavard
43a1ead1cb fix new prettier defaults 2020-05-12 18:18:37 +02:00
Pierre de La Morinerie
ef009f73e2 javascript: report upload FileReader errors to Sentry
We have quite a lot of `Error reading file` errors when uploading files.
These errors are generated by ActiveStorage `file_checksum.js` component
but it eats the actual reason of errors.

(See https://github.com/rails/rails/blob/5-2-stable/activestorage/app/javascript/activestorage/file_checksum.js#L38)

We can't really override the class to generate better errors, as they
are deeply nested in ActiveStorage class hierarchy, and not exported to
external code.

Instead, we hook into the FileReader event handler, to insert a logger
when this error occur. The original event handler will also still be
called as usual.

This is intended to be temporary. The debug code will be removed once
we get a better idea of what is going on.
2020-04-22 11:26:16 +02:00
Pierre de La Morinerie
b2231e98d5 javascript: don't report connectivity issues to Sentry 2020-04-16 11:20:45 +02:00
Pierre de La Morinerie
55788990da javascript: add a helpful message on connectivity error 2020-04-16 11:20:45 +02:00
Pierre de La Morinerie
432967bd76 javascript: make Uploader always throw the same kind of errors
A DirectUpload may fail for several reasons, and return many types of
errors (string, xhr response, Error objects, etc).

For convenience, wrap all these errors in a FileUploadError object.

- It makes easier for clients of the Uploader class to handle errors;
- It allows to propagate the error code and failure responsability.
2020-04-16 11:20:45 +02:00
Pierre de La Morinerie
d8f3b86b0e javascript: move auto-upload attachment to the Uploader class
Rationale:

- It makes more sense to handle the progress bar updates in a single class;
- This will allow us to unify the error handling.
2020-04-16 11:20:45 +02:00
Paul Chavard
442a6a3cdd Remove deprecated map reader 2020-04-15 18:07:09 +02:00
Pierre de La Morinerie
444732b117 javascript: don't allow to retry on direct upload 422
When the authenticity token is invalid, the creation of the blob before
the direct upload returns a 422.

In that case, the token will never become valid again, and it is useless
to try again. Don’t show the "Retry" button in this case.

NB: of course the real fix is to understand why the authenticity token
is so often invalid – but this will be for later.
2020-04-08 15:48:23 +02:00
Pierre de La Morinerie
38b0bd645c javascript: fix clicking on the icon of the auto-upload Retry button
When clicking on the icon, `event target` would be the icon, not
the button.

However delegates configures `this` to be the requested event target.
2020-04-08 15:48:23 +02:00
Pierre de La Morinerie
c506402dcb dossier: remove the now unused champId in auto-upload 2020-04-06 11:50:31 +02:00
Pierre de La Morinerie
91260e2867 dossier: fix upload route of piece_justificative in repetitions
In repetitions, `form.index` doesn't make much sense. Turns out we
don't really need the index of the champ: we can just use the champ id.
2020-04-06 11:50:31 +02:00
Pierre de La Morinerie
6417c0d2c0 dossiers: allow auto upload of attachments 2020-03-31 13:09:44 +02:00
Pierre de La Morinerie
e908b42b43 javascript: move the autosave files to a sub-directory 2020-03-23 14:02:29 +01:00
Paul Chavard
d8eb3ebb94 Load chartkick and highcharts only on stat pages 2020-02-25 09:07:07 +01:00
Paul Chavard
068471003d Add a timeout to select2 queries 2020-02-03 15:34:08 +01:00
Paul Chavard
a86129c3a1 Revert "Revert "Update javascript dependencies and add webpack-bundle-analyzer""
This reverts commit eddd59e554.
2020-02-03 14:54:25 +01:00
Keirua
eddd59e554
Revert "Update javascript dependencies and add webpack-bundle-analyzer" 2020-01-29 14:51:55 +01:00
Paul Chavard
7ebebf2e80 Refactor leaflet code for better loading 2020-01-28 16:37:44 +01:00
Keirua
455f164d02
Detail the reason why we include the search term in the results
Co-Authored-By: Pierre de La Morinerie <pierre.de_la_morinerie@beta.gouv.fr>
2020-01-27 16:47:32 +01:00
clemkeirua
9e858ae5ad possibilite de selectionner un resultat quand il n'y a rien dans le champ adresse 2020-01-27 12:51:06 +01:00
Paul Chavard
f03cca4386 Search departements by code 2020-01-23 14:12:19 +00:00
Paul Chavard
14295db9ad Revert "Revert "Merge pull request #4552 from tchak/champ-communes""
This reverts commit 4373cb22cb.
2020-01-14 18:46:07 +01:00
clemkeirua
4373cb22cb Revert "Merge pull request #4552 from tchak/champ-communes"
This reverts commit 4cec26f73a, reversing
changes made to 0ef25ef36c.
2020-01-13 16:26:27 +01:00
Paul Chavard
22aa2d4ee0 Make all location champs autocomplete 2020-01-07 11:52:51 +01:00
Pierre de La Morinerie
a5f2c84cbf sign_up: fix suggestions error when navigating away
When navigating away from the page, the field receives the 'focusout'
event – but stops to be present in the DOM.

Thus we need to check that the DOM element is actually present.
2019-12-19 17:45:14 +01:00
clemkeirua
841b00bafe focus sur le mot de passe lorsqu'on traite les suggestions 2019-12-03 14:06:12 +01:00
clemkeirua
8cab6ae19f retours divers 2019-12-03 14:06:12 +01:00
Pierre de La Morinerie
fb3f82074d Hide the suggestions when the user corrects the address 2019-12-03 14:06:11 +01:00
Pierre de La Morinerie
1d1260060e Fix the tests by using event delegation 2019-12-03 14:06:11 +01:00
clemkeirua
80b68afab5 implement email suggestion 2019-12-03 14:06:11 +01:00
clemkeirua
0bfdb2d5da fermeture et acceptation de la suggestion d'email 2019-12-03 14:06:11 +01:00
Pierre de La Morinerie
b9fd844633 dossiers: fix autosave not ignoring file inputs
The dossier autosave is supposed to ignore file inputs (which are
handled differently by ActiveStorage).

Fix a typo in the CSS selector.
2019-11-27 13:57:39 +00:00
Pierre de La Morinerie
30b822b135 dossiers: don't trigger an autosave when an attachment is modified
The draft autosave should not be triggered when attaching a file
(as file inputs are handled separately).
2019-11-27 10:37:33 +00:00
Pierre de La Morinerie
c6eab70679 dossiers: autosave shouldn't send files being uploaded
When a file is being uploaded asynchronosely, hidden input fields
are created by DirectUpload to contain the result of the upload.

However, before the upload finishes, the value of these inputs is not
meaningful. Moreover, it makes the ActiveRecord signature invalid – thus
preventing drafts from being saved.

Exclude these fields from the auto-save.
2019-11-27 10:37:33 +00:00
Pierre de La Morinerie
64d96646a3 javascript: autosave with explicit cookies settings
Older browsers implemented a different default value for `window.fetch`
credentials: it was omitted unless explicitely set.

So we force the value for these older browsers:

- Firefox 39-60
- Chrome 42-67
- Safari 10.1-11.1.2

See https://github.com/github/fetch#sending-cookies
2019-11-27 10:37:33 +00:00
Pierre de La Morinerie
6de5c0c9d1 autosave: make requests time out
This avoids recent requests being stuck because an older request never
finished.
2019-11-21 14:00:06 +01:00
Pierre de La Morinerie
68f5aae99d autosave: add feature test 2019-11-21 14:00:06 +01:00
Pierre de La Morinerie
bff7892ba8 dossiers: autosave drafts 2019-11-21 14:00:06 +01:00
simon lehericey
9ca026a630 Use a select2 box for looking to instructeurs 2019-11-18 17:08:51 +01:00
Pierre de La Morinerie
5be83bd01e procedure: make the layout more similar to the mockup 2019-10-31 10:27:19 +01:00
Pierre de La Morinerie
02384b078c procedure: remove UI to edit the european flag
This is an option we want to deprecate, and remove entirely in the
future.

Admins can still add the EU flag manually to their uploaded logo.
2019-10-31 10:27:19 +01:00
Nicolas Bouilleaud
72b7ff221c move procedure to new design 2019-10-31 10:27:19 +01:00
Paul Chavard
6215ccb3d7 Fix carte initialize 2019-08-21 10:48:49 +02:00
Paul Chavard
86b9ed2079 Run load scripts after ujs responces 2019-08-13 17:03:55 +01:00