[Jifty-commit] jifty branch, jifty_client, updated. 01f6dd0175b9d265c724e9d67e0a93968b5bd635

Jifty commits jifty-commit at lists.jifty.org
Sun May 2 01:55:17 EDT 2010


The branch, jifty_client has been updated
       via  01f6dd0175b9d265c724e9d67e0a93968b5bd635 (commit)
       via  fbb958c7db16719e9d51898b218983b2c9e9fe2f (commit)
       via  aee74ebbd5ed6a65606c7b5412bff256a323c269 (commit)
       via  9e063b740b2ab61d8fc2da8feb92453322450d37 (commit)
      from  3abb71013611b09829e944b15352958fba33fc36 (commit)

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

- Log -----------------------------------------------------------------
commit 9e063b740b2ab61d8fc2da8feb92453322450d37
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Sun May 2 13:53:42 2010 +0800

    Add the jiftyClient used to create the model so we can use it for sync

diff --git a/share/web/static/js/jifty_client.js b/share/web/static/js/jifty_client.js
index 7be617d..03fd260 100644
--- a/share/web/static/js/jifty_client.js
+++ b/share/web/static/js/jifty_client.js
@@ -56,12 +56,19 @@ Class("JiftyClient", {
         },
         mirrorModel: function (modelName, onSuccess, onFailure) {
             var that = this;
+
+            var onAjaxSuccess = function () {
+                that.meta.classNameToClassObject(modelName).meta.addClassMethod('jiftyClient', function () {
+                    return that;
+                });
+            };
+
             jQuery.ajax({
                 url: this._includeBaseUrl("/=/model/" + modelName + ".joose"),
                 dataType: "script",
                 type: 'GET',
                 error: onFailure,
-                success: onSuccess
+                success: onAjaxSuccess
             });
         },
     }

commit aee74ebbd5ed6a65606c7b5412bff256a323c269
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Sun May 2 13:54:25 2010 +0800

    Comma fix

diff --git a/share/web/static/js/jifty_client.js b/share/web/static/js/jifty_client.js
index 03fd260..74fa233 100644
--- a/share/web/static/js/jifty_client.js
+++ b/share/web/static/js/jifty_client.js
@@ -70,7 +70,7 @@ Class("JiftyClient", {
                 error: onFailure,
                 success: onAjaxSuccess
             });
-        },
+        }
     }
 });
 

commit fbb958c7db16719e9d51898b218983b2c9e9fe2f
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Sun May 2 13:54:47 2010 +0800

    First cut of generic loadById for records

diff --git a/share/web/static/js/jifty_client.js b/share/web/static/js/jifty_client.js
index 74fa233..ad233a2 100644
--- a/share/web/static/js/jifty_client.js
+++ b/share/web/static/js/jifty_client.js
@@ -54,6 +54,15 @@ Class("JiftyClient", {
                 success: onAjaxSuccess
             });
         },
+        loadById: function (className, id, onSuccess, onFailure) {
+            jQuery.ajax({
+                url: this._includeBaseUrl("/=/model/" + className + "/id/" + id + ".json"),
+                dataType: "json",
+                type: 'GET',
+                error: onFailure,
+                success: onSuccess
+            });
+        },
         mirrorModel: function (modelName, onSuccess, onFailure) {
             var that = this;
 

commit 01f6dd0175b9d265c724e9d67e0a93968b5bd635
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Sun May 2 13:55:01 2010 +0800

    First cut of a class method for loading a record of the given model

diff --git a/share/web/static/js/jifty_client.js b/share/web/static/js/jifty_client.js
index ad233a2..51818da 100644
--- a/share/web/static/js/jifty_client.js
+++ b/share/web/static/js/jifty_client.js
@@ -1,4 +1,22 @@
 Class("JiftyModel", {
+    classMethods: {
+        load: function (id, onSuccess, onFailure) {
+            var className = this.meta.getName();
+
+            var onAjaxSuccess = function (result) {
+                if (result.id) {
+                    var record = this.new(result);
+                    onSuccess(record);
+                }
+                else {
+                    onFailure(result);
+                }
+            };
+
+            alert(this.jiftyClient);
+            //this.jiftyClient.loadById(className, id, onAjaxSuccess, onFailure);
+        }
+    }
 });
 
 Class("JiftyClient", {

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


More information about the Jifty-commit mailing list