[Jifty-commit] r1515 - in jifty/trunk: share/web/static/js

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Fri Jul 7 23:07:34 EDT 2006


Author: trs
Date: Fri Jul  7 23:07:32 2006
New Revision: 1515

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/share/web/static/js/jifty.js

Log:
 r14126 at zot:  tom | 2006-07-07 23:05:02 -0400
 * Nicer "server down" message
 * Re-enable form inputs after failure


Modified: jifty/trunk/share/web/static/js/jifty.js
==============================================================================
--- jifty/trunk/share/web/static/js/jifty.js	(original)
+++ jifty/trunk/share/web/static/js/jifty.js	Fri Jul  7 23:07:32 2006
@@ -204,13 +204,19 @@
     },
 
     disable_input_fields: function() {
-	var disable = function() {
+        var disable = function() {
             // Triggers https://bugzilla.mozilla.org/show_bug.cgi?id=236791
             arguments[0].blur();
             arguments[0].disabled = true;
-	};
-	this.fields().each(disable);
-	this.buttons().each(disable);
+        };
+        this.fields().each(disable);
+        this.buttons().each(disable);
+    },
+
+    enable_input_fields: function() {
+        var enable = function() { arguments[0].disabled = false; };
+        this.fields().each( enable );
+        this.buttons().each( enable );
     }
 };
 
@@ -692,7 +698,15 @@
         }
     };
     var onFailure = function(transport, object) {
-        alert('No response from server!');
+        hide_wait_message_now();
+        
+        alert("Oops!  Looks like the server is down.\n\nTry again in a few minutes.");
+
+        var keys = request["actions"].keys();
+        for ( var i = 0; i < keys.length; i++ ) {
+            var a = new Action( request["actions"][ keys[i] ].moniker );
+            a.enable_input_fields();
+        }
     };
 
     // Build variable structure
@@ -755,6 +769,11 @@
         new Effect.Fade('jifty-wait-message', {duration: 0.2});
 }
 
+function hide_wait_message_now() {
+    if ($('jifty-wait-message'))
+        Element.hide('jifty-wait-message');
+}
+
 function show_action_result() {
     var popup = $('jifty-result-popup');
     if(!popup) return;


More information about the Jifty-commit mailing list