[Jifty-commit] jifty branch, jifty_client, updated. f73e1f665c2340db4790d7d01bd94f102c0a0f8e

Jifty commits jifty-commit at lists.jifty.org
Sun May 2 08:52:34 EDT 2010


The branch, jifty_client has been updated
       via  f73e1f665c2340db4790d7d01bd94f102c0a0f8e (commit)
      from  27913d35c2b97b03312b9ab1c012cdb1cb65f875 (commit)

Summary of changes:
 share/web/static/js/jifty_client.js |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

- Log -----------------------------------------------------------------
commit f73e1f665c2340db4790d7d01bd94f102c0a0f8e
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Sun May 2 20:52:36 2010 +0800

    Refactor sync into syncDiff

diff --git a/share/web/static/js/jifty_client.js b/share/web/static/js/jifty_client.js
index cb16905..462d3ee 100644
--- a/share/web/static/js/jifty_client.js
+++ b/share/web/static/js/jifty_client.js
@@ -1,11 +1,17 @@
 Class("JiftyModel", {
     methods: {
+        syncDiff: function (diff, onSuccess, onFailure) {
+            var className = this.meta.getName();
+            var actionName = "Update" + className;
+
+            // should we abort if diff contains only id?
+
+            this.meta.getClassObject().jiftyClient.runAction(actionName, diff, onSuccess, onFailure);
+        },
         sync: function (onSuccess, onFailure) {
             var record = this;
-            var className = record.meta.getName();
-            var actionName = "Update" + className;
             var diff = {
-                id: record.id // we must always send this
+                id: this.id // we must always send this
             };
 
             Joose.O.eachSafe(record._original, function (value, field) {
@@ -14,9 +20,7 @@ Class("JiftyModel", {
                 }
             });
 
-            // should we abort if diff contains only id?
-
-            this.meta.getClassObject().jiftyClient.runAction(actionName, diff, onSuccess, onFailure);
+            this.syncDiff(diff, onSuccess, onFailure);
         }
     },
     classMethods: {

-----------------------------------------------------------------------


More information about the Jifty-commit mailing list