<!--
Please read the contributing guidelines before making a PR:
  
https://github.com/openstreetmap/openstreetmap-website/blob/master/CONTRIBUTING.md

Pay particular attention to the section on how to present PRs:
  
https://github.com/openstreetmap/openstreetmap-website/blob/master/CONTRIBUTING.md#pull-requests
-->

### Description
<!--Describe your changes in detail. If you have made changes to the UI, 
include screenshots. If your PR addresses a Github issue, please link to 
it.-->
Addresses #4898, addresses data loss from accidental navigation aspect of #7044

Users writing diary entries or messages can accidentally navigate away from the 
page and lose their work. This adds the built-in browser warning when a user 
tries to leave a page with edits in progress.

The JavaScript should be able to be used on other forms across the site by 
adding the `data-unsaved-changes-warning` attribute to relevant forms.
### How has this been tested?
<!--Explain the steps you took to test your code.-->
PR is drafted before adding tests and and applying JS to relevant forms
You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/openstreetmap-website/pull/7076

-- Commit Summary --

  * Add JavaScript for checking if a form has been changed

-- File Changes --

    A app/assets/javascripts/unsaved_changes.js (48)

-- Patch Links --

https://github.com/openstreetmap/openstreetmap-website/pull/7076.patchhttps://github.com/openstreetmap/openstreetmap-website/pull/7076.diff
-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/7076
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/[email protected]>
_______________________________________________
rails-dev mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to