You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2016/07/31 14:34:50 UTC

svn commit: r1754662 - in /myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script: tobago-overlay.js tobago.js

Author: weber
Date: Sun Jul 31 14:34:50 2016
New Revision: 1754662

URL: http://svn.apache.org/viewvc?rev=1754662&view=rev
Log:
TOBAGO-1579 - AJAX: add overlay

Modified:
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-overlay.js
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-overlay.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-overlay.js?rev=1754662&r1=1754661&r2=1754662&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-overlay.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-overlay.js Sun Jul 31 14:34:50 2016
@@ -56,15 +56,16 @@ Tobago.Config.set("Ajax", "waitOverlayDe
         this.overlay.addClass("tobago-page-overlay-markup-wait");
       }
 
+      var overlayOffset = {top: 0, left: 0};
       if (this.element.is("body")) {
         this.overlay.css({
           position: "fixed",
           zIndex: 1500 // greater than the bootstrap navbar
         });
       } else {
+        overlayOffset = this.element.offset();
         this.overlay.outerWidth(this.element.outerWidth());
         this.overlay.outerHeight(this.element.outerHeight());
-        this.overlay.offset(this.element.offset());
         this.overlay.css({
           position: "absolute" // XXX is set via class, but seams to be overridden in IE11?
         });
@@ -97,6 +98,7 @@ Tobago.Config.set("Ajax", "waitOverlayDe
         backgroundColor: jQuery('.tobago-page').css("background-color"),
         opacity: 0})
           .show()
+          .offset(overlayOffset)
           .delay(this.options.error ? 0 : waitOverlayDelay)
           .animate({opacity: '0.8'}, this.options.error ? 0 : 250, "linear");
     },

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=1754662&r1=1754661&r2=1754662&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Sun Jul 31 14:34:50 2016
@@ -268,6 +268,21 @@ var Tobago = {
     Tobago.transition = Tobago.oldTransition;
   },
 
+  preparePartialOverlay: function(options) {
+    if (options.transition === undefined || options.transition == null || options.transition) {
+      console.info("options.render: " + options.render); // @DEV_ONLY
+      if (options.render) {
+        var partialIds = options.render.split(" ");
+        for (var i = 0; i < partialIds.length; i++) {
+          console.info("partialId: " + partialIds[i]); // @DEV_ONLY
+          var element = jQuery(Tobago.Utils.escapeClientId(partialIds[i]));
+          element.data("tobago-partial-overlay-set", true);
+          element.overlay({ajax: true});
+        }
+      }
+    }
+  },
+
   /**
    * Wrapper function to call application generated onunload function
    */
@@ -652,6 +667,7 @@ var Tobago = {
             } else {
               var action = commands.click.action ? commands.click.action : jQuery(this).attr("id");
               if (commands.click.execute || commands.click.render) {
+                Tobago.preparePartialOverlay(commands.click);
                 jsf.ajax.request(
                     jQuery(this).attr("id"),
                     event,
@@ -2095,5 +2111,17 @@ jsf.ajax.addOnEvent(function (event) {
         }
       }
     });
+  } else if (event.status == "complete") {
+    console.log("complete");// @DEV_ONLY
+    jQuery(event.responseXML).find("update").each(function () {
+      var updateId = jQuery(this).attr("id");
+      if ("javax.faces.ViewState" != updateId) {
+        var oldElement = jQuery(Tobago.Utils.escapeClientId(updateId));
+        console.info("Update after jsf.ajax complete: id='" + oldElement.attr("id") + "'"); // @DEV_ONLY
+        if (oldElement.data("tobago-partial-overlay-set")) {
+          oldElement.overlay("destroy")
+        }
+      }
+    });
   }
 });