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

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Tue Jun 6 17:20:25 EDT 2006


Author: nelhage
Date: Tue Jun  6 17:20:23 2006
New Revision: 1179

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

Log:
 r6923 at phanatique:  nelhage | 2006-06-06 17:20:18 -0400
 Adding Growl-esque notification support


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	Tue Jun  6 17:20:23 2006
@@ -543,10 +543,11 @@
                     for (var key = result.firstChild;
                          key != null;
                          key = key.nextSibling) {
+			show_action_result(result.getAttribute("moniker"),key);
                         if (key.nodeName == 'message') {
-                            // alert(key.textContent);
+			    //alert(key.textContent);
                         } else if (key.nodeName == 'error') {
-                            // alert('ERROR: '+key.textContent);
+			    //alert('ERROR: '+key.textContent);
                         }
                     }
                 }
@@ -616,7 +617,32 @@
         new Effect.Fade('jifty-wait-message', {duration: 0.2});
 }
 
-
+function show_action_result() {
+    var popup = $('jifty-result-popup');
+    if(!popup) return;
+
+    var moniker = arguments[0];
+    var result = arguments[1];
+    var status = result.nodeName;
+    var text = result.textContent;
+    if(status != 'message' && status != 'error') return;
+
+    var node = document.createElement('div');
+    node.setAttribute('id', 'result-' + moniker);
+    node.setAttribute('class', 'result-' + status);
+    node.innerHTML = text;
+
+    if(popup.hasChildNodes()) {
+	popup.insertBefore(node, popup.firstChild);
+    } else {
+	popup.appendChild(node);
+    }
+    new Effect.SlideDown(node, {duration: 0.5});
+    
+    setTimeout(function () {
+	    new Effect.Fade(node, {duration: 4.0});
+	}, 2000);
+}
 
 Jifty.Autocompleter = Class.create();
 Object.extend(Object.extend(Jifty.Autocompleter.prototype, Ajax.Autocompleter.prototype), {


More information about the Jifty-commit mailing list