call postAjaxLoad in reloadComponent; add corners only on reloaded elements stable
authorKatia Saurfelt <katia.saurfelt@logilab.fr>
Wed, 08 Jul 2009 13:58:37 +0200
branchstable
changeset 2338 3f7c7fbae94e
parent 2337 6620e5abcd99
child 2339 00b704535984
call postAjaxLoad in reloadComponent; add corners only on reloaded elements
web/data/cubicweb.ajax.js
web/data/cubicweb.htmlhelpers.js
--- a/web/data/cubicweb.ajax.js	Wed Jul 08 12:51:04 2009 +0200
+++ b/web/data/cubicweb.ajax.js	Wed Jul 08 13:58:37 2009 +0200
@@ -59,8 +59,8 @@
     if (typeof buildWidgets != 'undefined') {
 	buildWidgets(node);
     }
-    if (typeof roundedCornersOnLoad != 'undefined') {
-	roundedCornersOnLoad();
+    if (typeof roundedCorners != 'undefined') {
+	roundedCorners(node);
     }
     loadDynamicFragments(node);
     jQuery(CubicWeb).trigger('ajax-loaded');
@@ -231,6 +231,7 @@
 	    // make sure the component is visible
 	    removeElementClass(node, "hidden");
 	    swapDOM(node, domnode);
+	    postAjaxLoad(domnode);
 	}
     });
     d.addCallback(resetCursor);
--- a/web/data/cubicweb.htmlhelpers.js	Wed Jul 08 12:51:04 2009 +0200
+++ b/web/data/cubicweb.htmlhelpers.js	Wed Jul 08 13:58:37 2009 +0200
@@ -1,4 +1,5 @@
 CubicWeb.require('python.js');
+CubicWeb.require('jquery.corner.js');
 
 /* returns the document's baseURI. (baseuri() uses document.baseURI if
  * available and inspects the <base> tag manually otherwise.)
@@ -253,13 +254,25 @@
 }
 
 //============= page loading events ==========================================//
+
+CubicWeb.rounded = [
+		    ['div.sideBoxBody', 'bottom 6px'],
+		    ['div.boxTitle, div.boxPrefTitle, div.sideBoxTitle, th.month', 'top 6px'],
+		    ];
+
 function roundedCornersOnLoad() {
-    jQuery('div.sideBoxBody').corner('bottom 6px');
-    jQuery('div.boxTitle, div.boxPrefTitle, div.sideBoxTitle, th.month').corner('top 6px');
+    roundedCorners();
+}
+
+function roundedCorners(node) {
+    node == node || document.body;
+    node = jQuery(node);
+    for(var r=0; r<CubicWeb.rounded.length;r++){
+       node.find(CubicWeb.rounded[r][0]).corner(CubicWeb.rounded[r][1]);
+    }
 }
 
 jQuery(document).ready(roundedCornersOnLoad);
 
-
 CubicWeb.provide('htmlhelpers.js');