You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@community.apache.org by hu...@apache.org on 2019/08/07 15:15:53 UTC

svn commit: r1864628 - in /comdev/reporter.apache.org/trunk/site/wizard/js: source/unified.js wizard.js

Author: humbedooh
Date: Wed Aug  7 15:15:53 2019
New Revision: 1864628

URL: http://svn.apache.org/viewvc?rev=1864628&view=rev
Log:
add unload dialog if unsaved changes.

Modified:
    comdev/reporter.apache.org/trunk/site/wizard/js/source/unified.js
    comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js

Modified: comdev/reporter.apache.org/trunk/site/wizard/js/source/unified.js
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/wizard/js/source/unified.js?rev=1864628&r1=1864627&r2=1864628&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/wizard/js/source/unified.js (original)
+++ comdev/reporter.apache.org/trunk/site/wizard/js/source/unified.js Wed Aug  7 15:15:53 2019
@@ -287,9 +287,14 @@ function UnifiedEditor_check_changes(for
             let btn = new HTML('button', { onclick: 'save_draft();', class: 'btn btn-warning btn-sm'}, 'Save draft');
             saver.inject(btn);
             saver.style.display = 'inline-block';
+            window.onbeforeunload = (e) => {
+                return "You have unsaved changes to this report. Are you sure you wish to abandon these changes?";
+                }
+                
         }
     } else if (saver) {
         saver.style.display = 'none';
+        window.onbeforeunload = null;
     }
 }
 

Modified: comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js?rev=1864628&r1=1864627&r2=1864628&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js (original)
+++ comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js Wed Aug  7 15:15:53 2019
@@ -3537,9 +3537,14 @@ function UnifiedEditor_check_changes(for
             let btn = new HTML('button', { onclick: 'save_draft();', class: 'btn btn-warning btn-sm'}, 'Save draft');
             saver.inject(btn);
             saver.style.display = 'inline-block';
+            window.onbeforeunload = (e) => {
+                return "You have unsaved changes to this report. Are you sure you wish to abandon these changes?";
+                }
+                
         }
     } else if (saver) {
         saver.style.display = 'none';
+        window.onbeforeunload = null;
     }
 }