Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add warning when leaving form with unsaved changes #4570

Merged
merged 15 commits into from
Mar 26, 2020
Merged

Conversation

fzaninotto
Copy link
Member

@fzaninotto fzaninotto commented Mar 23, 2020

  • Display warning when leaving form with unsaved changes
  • Redisplay form with unsaved changes on cancel
  • Make it work when the user navigates away from the form using the back button
  • Add tests
  • Add documentation

Peek 23-03-2020 10-02

@fzaninotto fzaninotto changed the base branch from master to next March 23, 2020 09:06
@fzaninotto fzaninotto changed the title [WIP] Warn when leaving form with unsaved changes [RFR] Warn when leaving form with unsaved changes Mar 25, 2020
@fzaninotto fzaninotto changed the title [RFR] Warn when leaving form with unsaved changes [RFR] Add warning when leaving form with unsaved changes Mar 25, 2020
@fzaninotto fzaninotto added this to the 3.4.0 milestone Mar 25, 2020
@fzaninotto fzaninotto added the RFR Ready For Review label Mar 25, 2020
@fzaninotto fzaninotto changed the title [RFR] Add warning when leaving form with unsaved changes Add warning when leaving form with unsaved changes Mar 25, 2020
Copy link
Contributor

@djhi djhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

packages/ra-core/src/form/useWarnWhenUnsavedChanges.tsx Outdated Show resolved Hide resolved
@@ -90,6 +90,8 @@ const frenchMessages: TranslationMessages = {
not_found:
"L'URL saisie est incorrecte, ou vous avez suivi un mauvais lien.",
yes: 'Oui',
unsaved_changes:
"Certains changements n'ont pas été enregistrés. Etes-vous sûr(e) de vouloir quitter cette page ?",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Certains changements n'ont pas été enregistrés. Etes-vous sûr(e) de vouloir quitter cette page ?",
"Certains changements n'ont pas été enregistrés. Êtes-vous sûr·e de vouloir quitter cette page ?",

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have "sûr(e)" already in other translations, let's keep parentheses for this one.

fzaninotto and others added 5 commits March 26, 2020 09:14
Co-Authored-By: Gildas Garcia <1122076+djhi@users.noreply.github.com>
Co-Authored-By: Gildas Garcia <1122076+djhi@users.noreply.github.com>
Co-Authored-By: Gildas Garcia <1122076+djhi@users.noreply.github.com>
@djhi djhi merged commit 2248e32 into next Mar 26, 2020
@djhi djhi deleted the warn-when-unsaved-changes branch March 26, 2020 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants