[bugzilla-gnome-org-extensions] Save draft when navigating back to bug overview



commit 90b7394343542d74cc4acf1c14442fb6f011335c
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Sat Oct 3 15:14:12 2009 -0400

    Save draft when navigating back to bug overview
    
    Flush any queued draft-save when the user clicks on the link to return to
    the overview of all patches for the bug. (This might be better be done
    with a generic 'unload' handler; would need a bit of investigation.)

 js/splinter.js |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/js/splinter.js b/js/splinter.js
index 3e8daed..e378bdf 100644
--- a/js/splinter.js
+++ b/js/splinter.js
@@ -217,6 +217,11 @@ function queueSaveDraft() {
         saveDraftTimeoutId = setTimeout(saveDraft, 10000);
 }
 
+function flushSaveDraft() {
+    if (saveDraftTimeoutId != null)
+        saveDraft();
+}
+
 function getQueryParams() {
     var query = window.location.search.substring(1);
     if (query == null || query == "")
@@ -588,7 +593,9 @@ function start(xml) {
     $("#overview").show();
     $("#files").show();
 
-    $("#bugLink").attr('href', newPageUrl(theBug.id));
+    $("#bugLink")
+        .click(flushSaveDraft)
+        .attr('href', newPageUrl(theBug.id));
 
     $("#subtitle").text("Attachment " + theAttachment.id + " - " + theAttachment.description);
     $("#information").text(Utils.formatDate(theAttachment.date));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]