[Jifty-commit] jifty branch, jifty_client, updated. 47af7c57e5bcafc62f472f2b2ac9bf49b25e56a2

Jifty commits jifty-commit at lists.jifty.org
Sun May 2 03:19:59 EDT 2010


The branch, jifty_client has been updated
       via  47af7c57e5bcafc62f472f2b2ac9bf49b25e56a2 (commit)
      from  707300e50d96829e2c36f10f250dda5c3734540f (commit)

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

- Log -----------------------------------------------------------------
commit 47af7c57e5bcafc62f472f2b2ac9bf49b25e56a2
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Sun May 2 15:19:25 2010 +0800

    First pass at sync
    
        It uses JSON.parse(JSON.stringify(this)) which is awful but without
        it, things behave strangely.
    
        Also we're confusing Jifty by providing every field, some of which
        are lossy, when we update. We instead need to provide only updated
        fields.

diff --git a/share/web/static/js/jifty_client.js b/share/web/static/js/jifty_client.js
index 073419c..1a6d054 100644
--- a/share/web/static/js/jifty_client.js
+++ b/share/web/static/js/jifty_client.js
@@ -1,4 +1,11 @@
 Class("JiftyModel", {
+    methods: {
+        sync: function (onSuccess, onFailure) {
+            var className = this.meta.getName();
+            var actionName = "update" + className;
+            this.jiftyClient.runAction(actionName, JSON.parse(JSON.stringify(this)), onSuccess, onFailure);
+        }
+    },
     classMethods: {
         load: function (id, onSuccess, onFailure) {
             var that = this;

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


More information about the Jifty-commit mailing list