Bug 19267 - Advanced Editor - Rancor - Add warning before leaving page if there are unsaved modifications
Summary: Advanced Editor - Rancor - Add warning before leaving page if there are unsav...
Status: Pushed to Stable
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Nick Clemens
QA Contact: Josef Moravec
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-07 09:40 UTC by Nick Clemens
Modified: 2018-05-22 10:48 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 19267: Rancor - Warn before leaving page if record modified (1.33 KB, patch)
2017-09-07 09:44 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 19267: Rancor - Warn before leaving page if record modified (1.39 KB, patch)
2017-09-20 21:53 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 19267: Followup - only fire if changes and don't use javascript (1.16 KB, patch)
2018-01-08 16:54 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 19267: Rancor - Warn before leaving page if record modified (1.41 KB, patch)
2018-03-15 10:36 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 19267: Rancor - Warn before leaving page if record modified (1.46 KB, patch)
2018-03-30 21:12 UTC, Charles Farmer
Details | Diff | Splinter Review
Bug 19267: Rancor - Warn before leaving page if record modified (1.52 KB, patch)
2018-04-04 11:17 UTC, Josef Moravec
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens 2017-09-07 09:40:24 UTC

    
Comment 1 Nick Clemens 2017-09-07 09:44:52 UTC
Created attachment 66911 [details] [review]
Bug 19267: Rancor - Warn before leaving page if record modified

To test:
1 - Open the advanced editor
2 - Make some changes to a record
3 - Click on 'Patrons' or leave the page in some way
4 - Note there is no warning and changes are not saved
5 - Apply patch
6 - Open the advanced editor
7 - Make some changes
8 - Leave the page
9 - Note you get a warning of unsaved changes and can stay on the page
Comment 2 Katrin Fischer 2017-09-20 21:53:32 UTC
Created attachment 67274 [details] [review]
Bug 19267: Rancor - Warn before leaving page if record modified

To test:
1 - Open the advanced editor
2 - Make some changes to a record
3 - Click on 'Patrons' or leave the page in some way
4 - Note there is no warning and changes are not saved
5 - Apply patch
6 - Open the advanced editor
7 - Make some changes
8 - Leave the page
9 - Note you get a warning of unsaved changes and can stay on the page

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 3 Josef Moravec 2017-12-22 20:48:12 UTC
Sorry, but this is wrong.

You need to return 'undefined' in case there are no changes, this patch just fires the question dialog everytime.

See this page for more:
https://stackoverflow.com/questions/7317273/warn-user-before-leaving-web-page-with-unsaved-changes

We could also consider to add this functionality to all Koha pages (or almost all) through some existing plugin like http://plugins.jquery.com/are-you-sure/
but thats definitely out of scope of this bug, as Rancor is a special case.
Comment 4 Josef Moravec 2017-12-22 20:51:47 UTC
One more thing: You even don't need jquery this should be enough:

window.onbeforeunload = function() { ... };
Comment 5 Nick Clemens 2018-01-08 16:54:46 UTC
Created attachment 70326 [details] [review]
Bug 19267: Followup - only fire if changes and don't use javascript
Comment 6 Josef Moravec 2018-01-10 11:09:40 UTC
Please, squash the patches and ask for new sign-off, it's completely different code now...
Comment 7 Nick Clemens 2018-03-15 10:36:34 UTC
Created attachment 72924 [details] [review]
Bug 19267: Rancor - Warn before leaving page if record modified

To test:
1 - Open the advanced editor
2 - Make some changes to a record
3 - Click on 'Patrons' or leave the page in some way
4 - Note there is no warning and changes are not saved
5 - Apply patch
6 - Open the advanced editor
7 - Make some changes
8 - Leave the page
9 - Note you get a warning of unsaved changes and can stay on the page
Comment 8 Charles Farmer 2018-03-30 21:12:43 UTC
Created attachment 73505 [details] [review]
Bug 19267: Rancor - Warn before leaving page if record modified

To test:
1 - Open the advanced editor
2 - Make some changes to a record
3 - Click on 'Patrons' or leave the page in some way
4 - Note there is no warning and changes are not saved
5 - Apply patch
6 - Open the advanced editor
7 - Make some changes
8 - Leave the page
9 - Note you get a warning of unsaved changes and can stay on the page

Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>
Comment 9 Josef Moravec 2018-04-04 11:17:21 UTC
Created attachment 73609 [details] [review]
Bug 19267: Rancor - Warn before leaving page if record modified

To test:
1 - Open the advanced editor
2 - Make some changes to a record
3 - Click on 'Patrons' or leave the page in some way
4 - Note there is no warning and changes are not saved
5 - Apply patch
6 - Open the advanced editor
7 - Make some changes
8 - Leave the page
9 - Note you get a warning of unsaved changes and can stay on the page

Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 10 Jonathan Druart 2018-04-04 19:07:37 UTC
Pushed to master for 18.05, thanks to everybody involved!
Comment 11 Nick Clemens 2018-05-14 21:14:19 UTC
Pushed to stable for 17.11.06

Awesome work all!
Comment 12 Fridolin SOMERS 2018-05-22 10:48:12 UTC
Pushed to 17.05.x for v17.05.12