[bugzilla-gnome-org-extensions] Add a notice when restoring from review



commit b2f0db78b8a53f4c5ae7bf07cc32eddaba2c76cd
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Sat Sep 12 23:03:13 2009 -0400

    Add a notice when restoring from review
    
    Add a label (in dark red) when we've restored a review so that it's more obvious
    that we aren't starting from scratch.

 js/splinter.js   |   16 +++++++++++++---
 web/index.html   |    3 +++
 web/splinter.css |    5 +++++
 3 files changed, 21 insertions(+), 3 deletions(-)
---
diff --git a/js/splinter.js b/js/splinter.js
index 3d2390e..8cbcf30 100644
--- a/js/splinter.js
+++ b/js/splinter.js
@@ -410,8 +410,20 @@ function addPatchFile(file) {
 var REVIEW_RE = /^\s*review\s+of\s+attachment\s+(\d+)\s*:\s*/i;
 
 function start(xml) {
-    if (reviewStorage)
+    var i;
+
+    if (reviewStorage) {
         theReview = reviewStorage.loadDraft(theBug, theAttachment, thePatch);
+        if (theReview) {
+            var storedReviews = reviewStorage.listReviews();
+            $("#restored").show();
+            for (i = 0; i < storedReviews.length; i++) {
+                if (storedReviews[i].bugId == theBug.id &&
+                    storedReviews[i].attachmentId == theAttachment.id)
+                    $("#restoredLastModified").text(Utils.formatDate(new 
Date(storedReviews[i].modificationTime)));
+            }
+        }
+    }
     if (!theReview)
         theReview = new Review.Review(thePatch);
 
@@ -432,8 +444,6 @@ function start(xml) {
     else
         $("#attachmentStatusSpan").hide();
 
-    var i;
-
     for (i = 0; i < configAttachmentStatuses.length; i++) {
         $("<option></option")
             .text(configAttachmentStatuses[i])
diff --git a/web/index.html b/web/index.html
index d7aa0c3..da8faee 100644
--- a/web/index.html
+++ b/web/index.html
@@ -51,6 +51,9 @@
       </div>
       <div id="oldReviews">
       </div>
+      <div id="restored" style="display: none;">
+       Restored from draft; last edited <span id="restoredLastModified"></span>
+      </div>
       <div>
        <div>Overall Comment:</div>
        <textarea id="myComment"></textarea>
diff --git a/web/splinter.css b/web/splinter.css
index e2b98bd..036f965 100644
--- a/web/splinter.css
+++ b/web/splinter.css
@@ -121,6 +121,11 @@ body {
     margin-top: 0.5em;
 }
 
+#restored {
+    color: #bb0000;
+    margin-bottom: 0.5em;
+}
+
 #myComment {
     width: 100%;
     height: 10em;


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