Commit graph

482 commits

Author SHA1 Message Date
simon lehericey
19f81b594b merge with an existing account by using the password 2021-10-14 14:47:50 +02:00
Pierre de La Morinerie
b2774ed2f6 js: fix pays API request on older Edge and Safari
The /api/pays API requires user authentication. However older versions
of Edge and Safari don't transmit cookies by default during a
`fetch` request.

Use the `credentials: 'same-origin'` option explicitely to fix the
countries list.
2021-09-30 16:21:24 +02:00
Pierre de La Morinerie
4f33a7b72e js: improve auto-save-controller documentation 2021-09-07 16:45:52 -05:00
Pierre de La Morinerie
ad8dcc7f7d js: don't report autosave failures that are timeouts
This prevents spamming Sentry with "[Autosave] Error: 0" messages.
2021-09-07 16:45:52 -05:00
Pierre de La Morinerie
8dce7d59ed js: redirect to sign-in when a ujs link_to receives a 401
Before, when a 401 was received by a ujs-enabled link (like `link_to …,
method: :delete, data: { remote: true }`, rails-ujs tried to insert the
response text as a Javascript script.

As the script was something like `Please sign-in`, which is not valid
Javascript, the browser would throw an "Unexpected token" error.

The typical use-case is:

1. The user open a form in a tab,
2. The user disconnects in another tab,
3. In the first tab, the user clicks on a remote "Delete" link_to

In that case the browser raised an error in the console (and in Sentry),
but the user would see nothing.

With this commit, all 401 ujs errors are turned into redirects to the
sign-in page.

Fix https://sentry.io/organizations/demarches-simplifiees/issues/2522512693/activity/
2021-09-07 16:45:52 -05:00
Pierre de La Morinerie
255c00c174 js: ignore a new variant of the same warning 2021-09-07 16:45:52 -05:00
Jérôme Desboeufs
7079af2fd4
Update photographies-aeriennes basemap URL 2021-09-01 21:58:12 +02:00
Pierre de La Morinerie
7380d27d78 js: fix null xhr in autosave error handling
Sentry reports many cases of the xhr object being missing in the
error handler.

Ensure the error handling code doesn't crash because of the missing xhr.
2021-08-31 14:54:02 -05:00
Paul Chavard
5d63ced246 fix(eslint): fix eslint warnings 2021-08-31 18:14:04 +02:00
Paul Chavard
a3cc072bbd feat(i18n): translate countries selector 2021-08-31 13:15:26 +02:00
Paul Chavard
b81cfea0e4 fix(combo-search): can input empty value 2021-08-18 15:48:37 +01:00
Paul Chavard
2a84f14521 Make generic 2021-08-18 12:09:20 +02:00
Pierre de La Morinerie
e1909ed29f brouillon: redirect to sign-in when disconnected
There are two cases where the draft auto-save might fail because the
user is no longer authenticated:

- The user signed-out in another tab,
- The brower quit and re-opened, so the Session cookie expired.

In both cases, the auto-save will never succeed until the user
authenticates again, so displaying a "Retry" button is cruel.

Moreover, in plus of all auto-save requests failing with a small error,
the actual hard failure only occurs after filling all the form and
trying to submit it. Then the user is redirected to the sign-in page –
but all their changes are lost.

Instead, we now redirect to the sign-in page on the first 401 error
during the auto-save, let the user sign-in, and then redirect back to
the form.
2021-07-22 11:58:02 +02:00
Pierre de La Morinerie
7808f6dd4f js: document utils.ajax() 2021-07-22 11:58:02 +02:00
Pierre de La Morinerie
c6fff58f38 js: fix typo in comment 2021-07-22 11:58:01 +02:00
Pierre de La Morinerie
071d9145ca js: don't attempt to log unexistent statusText 2021-07-22 11:58:01 +02:00
Paul Chavard
c7b0b8495b Get more results from communes API and use local matcher 2021-07-20 13:34:17 +02:00
Pierre de La Morinerie
63cde95fc9 js: ignore errors generated by a Microsoft crawler
Sentry has a lot of Javacript errors stating:

> UnhandledRejection: Non-Error promise rejection captured with value: Object Not Found Matching Id:2 

This is apparently caused by a Microsoft crawler (maybe for scanning
targets of email links), and can be safely ignored.

See https://forum.sentry.io/t/unhandledrejection-non-error-promise-rejection-captured-with-value/14062/12
2021-07-20 09:21:59 +02:00
Paul Chavard
38fdaa7404 Trigger onStyleChange when leyers are toggled 2021-07-07 16:23:55 +02:00
Paul Chavard
1e4c943392 Fix map controls checkbox labels 2021-07-07 15:38:21 +02:00
Paul Chavard
65adce1e24 Fix cadastres layer 2021-07-07 15:38:21 +02:00
Paul Chavard
527db7631e Add a point on map from coordinates input 2021-07-07 13:33:28 +02:00
Paul Chavard
0ce708028d Prevent crashes in combo boxes 2021-07-06 15:06:38 +02:00
Paul Chavard
87fb98f5ed Make IGN layers opacity configurable 2021-07-06 10:36:12 +02:00
Paul Chavard
fc966a2761 IGN layers on maps can now be disabled by the user 2021-06-30 20:07:52 +02:00
Paul Chavard
10cdd2c77e Apply suggestions from code review
Co-authored-by: Pierre de La Morinerie <kemenaran@gmail.com>
2021-06-16 09:38:47 +02:00
Paul Chavard
7f28c49887 expand commune searches with multiple post codes 2021-06-16 09:29:25 +02:00
Paul Chavard
7575f50d25 Fix autocomplete on blur 2021-06-15 10:13:31 +02:00
Paul Chavard
7f4e174871 Declare useCallback dependencies 2021-06-15 10:13:31 +02:00
simon lehericey
6be0bbaa9c Change bottom champs editor button from enregistrer to continuer 2021-06-15 09:54:32 +02:00
Paul Chavard
1b0cc62fc2 Add cadastres to MapReader 2021-05-24 11:57:00 +02:00
Paul Chavard
2244263b49 Add cadastres to MapEditor 2021-05-24 11:57:00 +02:00
Paul Chavard
19440afebf Improuve mapbox utilis and shared components 2021-05-24 11:57:00 +02:00
Paul Chavard
bf462380e6 MultiSelect: select values on blur 2021-05-20 17:21:13 +02:00
Paul Chavard
3313ea5885 MultiSelect: do not show empty results on free form inputs 2021-05-20 17:21:13 +02:00
Paul Chavard
e0d8d096f2 MultiSelect: improuve setters 2021-05-20 17:21:13 +02:00
Paul Chavard
868ec214ce MultiSelect: enable adding multiple emails with , or space 2021-05-20 17:21:13 +02:00
Paul Chavard
bf9f29cc71 Fix messagerie scroll to last message 2021-05-20 11:58:54 +02:00
Paul Chavard
69ab7854c2 replace fontawesome with heroicons 2021-04-29 15:20:05 +02:00
Paul Chavard
6e1b4a2067 Update and pin mapbox-gl 2021-04-28 15:34:53 +02:00
Paul Chavard
85b907807a Improuve ComboMultipleDropdownList style 2021-04-28 12:54:45 +02:00
Paul Chavard
6836191ca5 Improuve commune autocomplete results 2021-04-22 09:59:21 +01:00
Christophe Robillard
6026793c1d focus to target after toggle 2021-03-17 11:31:51 +01:00
Christophe Robillard
df3bd3a1d2 handle focus during and after upload 2021-03-17 11:31:51 +01:00
Christophe Robillard
43039d1755 add aria-value min, max and now for progressbar upload 2021-03-17 11:31:51 +01:00
Paul Chavard
6f543d3770 Handle invalid GeoJSON in the editor 2021-03-11 15:51:09 +01:00
Paul Chavard
9f8c55969d Add proper external data API errors handling 2021-03-04 10:16:06 +01:00
Paul Chavard
2c2b392d6c Fix multiselect labels
only add values to new values if it is a new value
2021-02-19 12:08:54 +01:00
Paul Chavard
24f71ccc1a Improuve multi select
In multi select with acceptNewValues option alway keep the new value as the first item in the list to make it easier to add it
2021-02-19 10:53:16 +01:00
Paul Chavard
6756db1013 Update react-query 2021-02-16 18:14:11 +01:00
Paul Chavard
bb49f6e151 replace react-use with use-debounce
this is a much lighter dependencie
2021-02-16 18:14:10 +01:00
Paul Chavard
3dae5b5c04 update react 2021-02-16 18:14:10 +01:00
Paul Chavard
df80f5681d remove react-scroll-to-component 2021-02-16 18:14:10 +01:00
Paul Chavard
1c164c4376 Use jsx extension 2021-02-16 18:14:10 +01:00
Paul Chavard
881820888a Use stable cache key for useMemo 2021-02-16 16:47:15 +01:00
Christophe Robillard
8b55f67964 accepte nouvelles valeurs pour ComboMultipleDropdownList 2021-02-16 16:47:15 +01:00
Paul Chavard
06e282b839 supprime select2
select2 n'est plus utilisé. Il est remplacé par
ComboMultipleDropdownList
2021-02-16 16:47:15 +01:00
Christophe Robillard
e048f48241 create ComboMultipleDropdownList component 2021-02-16 16:47:14 +01:00
Paul Chavard
a503417298 Remove old css and js 2021-02-02 15:26:11 +01:00
Paul Chavard
9f691dce4c Set external_id from combo search inputs 2021-01-15 11:50:02 +01:00
Paul Chavard
91be115c70 Add annuaire_education champ ui 2021-01-14 17:57:48 +01:00
Paul Chavard
6ca9daab0f Ensure a combo always autosave value on change 2021-01-14 17:31:37 +01:00
Paul Chavard
075ee9dcde Fix cadastres layer 2020-12-11 14:47:50 +01:00
Paul Chavard
1af0d30d94 Use new optional layers in maps module 2020-12-10 11:26:16 +01:00
Paul Chavard
eaa9b1c071 Expose all optional layers in TypeDeChamp editor 2020-12-10 11:26:16 +01:00
Christophe Robillard
ddd50993a5 cache pays 2020-12-08 13:09:08 +00:00
Christophe Robillard
12d1a5bece implement ComboPaysSearch 2020-12-08 13:09:08 +00:00
Paul Chavard
618c81b9a6 Mount react components on page updates 2020-10-15 18:46:12 +02:00
Paul Chavard
ca0ba4ba2d replace deprecated react-loadable with suspense 2020-10-15 17:30:49 +02:00
Paul Chavard
752ee78c49 Use fetch instead of jQuery 2020-10-13 10:55:10 +02:00
Paul Chavard
70bf9ea92f remove unused select2 code 2020-10-08 15:26:15 +02:00
Paul Chavard
8a2f079acb Implement ComboAdresseSearch 2020-10-08 15:26:14 +02:00
Paul Chavard
b6c94a3758 Implement ComboCommunesSearch 2020-10-08 15:26:14 +02:00
Paul Chavard
4217dcd94b Implement ComboDepartementsSearch 2020-10-08 15:26:14 +02:00
Paul Chavard
2c7ee82d31 Implement ComboRegionsSearch 2020-10-08 15:26:14 +02:00
Paul Chavard
1b57d94d93 Use @reach/combobox instead of select2 2020-10-08 15:26:14 +02:00
Paul Chavard
5df7a729e7 Add a wrapper to catch chart rendering before chartkick is loaded 2020-10-07 11:40:07 +02:00
Paul Chavard
d8852c7dc5 Lazily load trix 2020-10-07 11:40:07 +02:00
Paul Chavard
95eb907090 remove unused javascript 2020-10-07 11:39:57 +02:00
Christophe Robillard
6fd0134b6d convert to es6 classes 2020-09-22 16:09:15 +02:00
Christophe Robillard
8baaee8810 load expanded buttons only for contact form 2020-09-22 16:09:15 +02:00
Christophe Robillard
5bd4644c2c fix js lint errors 2020-09-22 16:09:15 +02:00
Christophe Robillard
9be015752a set input value for question type of contact page 2020-09-22 16:09:15 +02:00
Christophe Robillard
df9a15a224 expand buttons for contact page 2020-09-22 16:09:15 +02:00
Paul Chavard
512cdeb6ff normalize features on import 2020-09-22 09:12:55 +02:00
kara Diaby
5c68d75107 add titre_identite champ 2020-09-18 14:57:08 +02:00
Christophe Robillard
51c4001a1a add aria-disclosure for Mon compte button 2020-09-15 18:12:26 +02:00
Paul Chavard
bbcdff0ccf Use IGN plan v2 and add MNHN data sources 2020-09-15 14:39:02 +02:00
Pierre de La Morinerie
e033ec3404 js: ignore missing DOM element on ProgressBar
Currently ProgressBar is used to monitor upload progress of attachments.

But there's two cases where the associated DOM element may be removed:

- In the champs editor, when the list scrolls, DOM elements are removed
and added dynamically by React;
- In the user form, the user might start an upload on a repetition, and
then remove the associated row during the download.

In both those cases, we don't want the missing DOM element to trigger
an error.
2020-09-03 15:03:13 +02:00
kara Diaby
ae61c279af migrate emails text editor to new interface 2020-09-03 14:42:22 +02:00
Paul Chavard
ec72fdd164 Remove migration service 2020-09-02 11:26:26 +02:00
kara Diaby
1788471664 carto hack : traduce edition buttons in french 2020-09-01 17:41:20 +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
Paul Chavard
4c87e547b3 Put IGN map behind a feature flag 2020-07-30 17:22:28 +02:00
Paul Chavard
f1cbc9846e Add carte ign 2020-07-30 16:58:20 +02:00
Paul Chavard
87a1661cdc fix prop type error 2020-07-22 11:10:14 +02:00
Pierre de La Morinerie
5949266e89 javascript: silence Crisp warning in Javascript console 2020-06-26 15:57:14 +02:00
kara Diaby
3dacff19d5 [CARTO] fix the GPX and KML imports in order to manage multiples draw types in the same file 2020-06-18 16:28:46 +02:00
Paul Chavard
d9f7d10425 Refactor Map Reader|Editor to handle events from geo areas list 2020-06-09 18:45:45 +02:00
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
kara Diaby
f104567619 Add 2 cards style for MapEditor + optim import gpx kml 2020-06-02 13:24:29 +02:00
kara Diaby
1e3a042a69 Add styles without cadastres in mapReader + tutorials pages in MapEditor 2020-05-28 17:50:14 +02:00
kara Diaby
d8ae089e93 [Carto] Improve files import UX + import KML files 2020-05-20 14:17:27 +02:00
kara Diaby
c37b32ac94 fix the search input addresses return box bug [Carto] 2020-05-19 15:34:48 +02:00
Pierre de La Morinerie
833d7a3b59 javascript: ignore most common upload errors also in standard uploads
In #5149, we ignored most common upload errors, but only for
auto-uploads.

This PR ignores those errors also for standard uploads.
2020-05-18 11:50:29 +02:00
Paul Chavard
d44df9cc2a Fix map apercu 2020-05-14 14:28:54 +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
Paul Chavard
03075afa5b Update javascript dependencies 2020-05-14 13:21:42 +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
kara Diaby
474521c841 Adapt style for Map reader (point, line) 2020-05-12 17:47:28 +02:00
kara Diaby
1cc04092f4 import GPX file in browser [Carto] 2020-05-11 11:36:36 +02:00
Paul Chavard
05e408225b Implement atomic operations on MapEditor 2020-05-06 16:46:14 +02:00
kara Diaby
9aea1fffee Migrate the map editor to mapbox-gl with react component 2020-04-27 11:30:32 +02:00
Pierre de La Morinerie
6f4075f38e javascript: fix FileUploadError stacktraces
When subclassing a JS error, most browsers include the constructor
stacktrace :/

This is an issue, because:
- The stacktrace is deeper than it should be
- The stacktrace reaches into a polyfill for which there is not source
map, which causes Sentry to infer the issue grouping from the JS file
name. And the fingerprinted name changes on each release. So for each
release, the stacktrace is different ; and Sentry can't group issues
properly.
2020-04-23 12:27:26 +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
Paul Chavard
bc8217e030 Carte Editor sends FeatureCollection to the server 2020-04-16 18:29:19 +02:00
Pierre de La Morinerie
769e98f63e javascript: fix the progress bar removal on success
When using auto-attach, the response HTML fragment replaces the progress
bar – so it doesn't need to be removed twice.
2020-04-16 17:02:23 +02:00
Pierre de La Morinerie
647ad3ba10 javascript: consider unknown upload errors as client errors 2020-04-16 12:59:14 +02:00
Pierre de La Morinerie
b006c33ebe javascript: parse the upload status code correctly
Previously the status was "Status: 422" instead of just 422.
2020-04-16 12:54:18 +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
Paul Chavard
22604013d0 Expose multiple user selections on champ carte 2020-04-15 18:07:09 +02:00
Paul Chavard
52d2ace823 Remove quartiers prioritaires 2020-04-14 10:29:59 +02:00
Pierre de La Morinerie
61660b1b3b javascript: remove unused jQuery.active bookkeeping 2020-04-09 17:52:47 +02:00
Pierre de La Morinerie
c633cd0888 javascript: improve Sentry grouping of direct upload errors
DirectUpload returns errors as strings, including an HTTP status and a
file name (and without a stack trace).

But Sentry groups issues according to the stack trace, and maybe the
error message in last resort.

So we have an issue: as all DirectUpload errors logged by Sentry are
generated on the same line, with random-looking messages, Sentry groups
them either too or too little aggressively.

Instead of creating all the errors on the same line:

- add some `if`s statements to create them on different lines (and so
  with different stack traces),
- strip the file name from the error message.

This allows Sentry to group the errors properly, with meaningful error
messages.
2020-04-09 17:38:44 +02:00
Pierre de La Morinerie
bc1c15b81d javascript: make DirectUpload errors return true error objects
DirectUpload errors are string (instead of error objects). But Sentry
works better if we have true errors, which include the stacktrace.
2020-04-09 12:50:47 +02:00
kara Diaby
d18bc1c421 Improve the mapbox-gl support detection for older browsers 2020-04-09 11:01:20 +02:00
kara Diaby
56e9834389 Revert "Revert "Revert "Revert "feat/4893 - migrate the mapReader to mapbox-gl with react""""
This reverts commit 473ed00b6c.
2020-04-09 11:01:20 +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
kara Diaby
473ed00b6c Revert "Revert "Revert "feat/4893 - migrate the mapReader to mapbox-gl with react"""
This reverts commit fe0b3c2215.
2020-04-07 18:14:07 +02:00
kara Diaby
fe0b3c2215 Revert "Revert "feat/4893 - migrate the mapReader to mapbox-gl with react""
This reverts commit 3e21b78142.
2020-04-07 18:11:11 +02:00
Pierre de La Morinerie
3e21b78142
Revert "feat/4893 - migrate the mapReader to mapbox-gl with react" 2020-04-07 15:32:14 +02:00
Pierre de La Morinerie
38c0cdc360 javascript: ignore errors of attachments pooler
Pooling for attachment status is a background operation. Errors should
not be reported to the user, who didn't even ask for this operation to
take place.

This is why we ignore all errors, whether Javascript exceptions or
network errors.
2020-04-07 12:35:54 +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
kara Diaby
aa56cfd7a0 migrate map to mapbox-gl with a react component 2020-04-02 15:39:47 +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
a1083ca253 javascript: add some comments to the upload systems 2020-03-31 13:09:17 +02:00
Pierre de La Morinerie
7a27e78452 specs: remove unused wait-for-ajax helper
This helper is:
- no longer used;
- buggy (not all requests increment it);
- discouraged (we should instead match an UI change that signals the end
of an ajax request).

Good riddance.
2020-03-31 12:54:49 +02:00
Pierre de La Morinerie
e908b42b43 javascript: move the autosave files to a sub-directory 2020-03-23 14:02:29 +01:00
Pierre de La Morinerie
ec2199f7b1 javascript: make utils.ajax() return a promise
This allow to use `await ajax(…)`, and still have Rails manage the
request, insert the proper headers and tokens, etc.
2020-03-19 18:28:24 +01:00
Paul Chavard
d8eb3ebb94 Load chartkick and highcharts only on stat pages 2020-02-25 09:07:07 +01:00
Paul Chavard
0b06864f7a Upgrade core-js 2020-02-24 19:43:07 +01:00
Paul Chavard
5afe158c89 Tweak a bit timeout values for export polling 2020-02-03 15:56:10 +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
Paul Chavard
08400cdd4c Poll for export readiness updates 2020-01-29 22:52:03 +01:00
Keirua
eddd59e554
Revert "Update javascript dependencies and add webpack-bundle-analyzer" 2020-01-29 14:51:55 +01:00
Paul Chavard
4982039086 Fix fontawesome not tree shaking properly 2020-01-28 16:37:44 +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
e61e39d345 Remove unused code and tests 2020-01-07 11:52:51 +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
c2c3f05262 p'tit fix d'utilisabilité 2019-12-16 09:49:23 +01:00
Paul Chavard
3a142fea40 Isolate react components from react loaders 2019-12-04 16:26:59 +01:00
Paul Chavard
03326169c5 Always load IntersectionObserver to fix old browsers
fix #4614
2019-12-04 16:26:59 +01:00
Pierre de La Morinerie
f351ade434 javascript: expose Turbolinks globally
When calling `redirect_to` in a Rails controller that emits Javascript,
Rails will emit `Turbolinks.replace(…)` commands. And for this,
Turbolinks needs to be globally available.
2019-12-03 16:28:47 +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
Paul Chavard
2cf415dc41 Simplify React components loader 2019-11-28 14:45:40 +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
52051914aa editor: disable the "Add champ" button until the champ is saved
Otherwise some champs are created before the previous one has been
saved, and React complains that several champs have the same
`champ-undefined` key.

(Plus it made the tests flaky and unreliable.)
2019-11-27 11:58:46 +01:00
Pierre de La Morinerie
7ed649dfca editor: don't create a champ by default
Before the editor attempted to create a default champ as soon as the
list became empty.

This created many race conditions, which made the tests flaky.

Remove this behavior, and add an empty label instead.
2019-11-27 11:58:45 +01: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
2309017727 javascript: add a window.fetch polyfill
This allows the autosave to work on browsers that don't support fetch:

- IE 11
- Edge < 14
- Safari < 11
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
Pierre de La Morinerie
74a9db6580 javascript: make utils resilient to missing elements 2019-11-20 17:36:09 +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
8a7f4ec769 editor: reduce scroll duration when inserting a new champ
The previous default was 1s, which felt slooooow.
2019-11-07 15:49:15 +01:00
Pierre de La Morinerie
fc8a0d46ff editor: insert new champs after the last fully visible champ
Before, when the "Add new champ" button was clicked, the new champ
was inserted after the **first** fully visible champ.

That was most of the time unexpected. The correct behavior would be to
insert the new champ after the **last** fully visible champ.

That's what this commit does. Now the "Add new champ" behavior feels
much less confusing.
2019-11-07 15:19:11 +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
Pierre de La Morinerie
bb024d1850 javascript: display a localized message on upload errors 2019-10-24 16:12:56 +02:00
Pierre de La Morinerie
a3057afc22 javascript: report upload errors to Sentry 2019-10-24 16:12:56 +02:00
Paul Chavard
a192924ee5 Fix infinit rerendering of TypeDeChamp component
fix #4428
2019-10-24 13:31:54 +02:00
Nicolas Bouilleaud
c26a701a17 Refactor and redesign publish modal
* remove the autocomplete menu
* use ujs to pre-validate the procedure
* tweak the UI
2019-09-17 16:30:48 +02:00