Merge with 6ec62ab8cb8de4faa2d8133bce96448dbfd83ae1
authorveltr
Wed, 29 Aug 2012 16:35:07 +0200
changeset 29 95a1e550e5b1
parent 28 805d85b3f390 (current diff)
parent 27 6ec62ab8cb8d (diff)
child 30 8aa0cac741a0
Merge with 6ec62ab8cb8de4faa2d8133bce96448dbfd83ae1
--- a/client/js/models.js	Tue Aug 28 18:26:13 2012 +0200
+++ b/client/js/models.js	Wed Aug 29 16:35:07 2012 +0200
@@ -21,7 +21,7 @@
         constructor: function(options) {
             
             if (typeof options !== "undefined") {
-                options._id = options.id || Models.getUID(this);
+                options._id = options._id || options.id || Models.getUID(this);
                 options.title = options.title || "(untitled " + this.type + ")";
                 options.description = options.description || "";
                 options.uri = options.uri || "";
@@ -57,12 +57,12 @@
         },
         toJSON: function() {
             return {
-                id: this.get("id"),
+                _id: this.get("_id"),
                 title: this.get("title"),
                 uri: this.get("uri"),
                 description: this.get("description"),
                 color: this.get("color"),
-            }
+            };
         },
     });
     
@@ -82,13 +82,13 @@
         },
         toJSON: function() {
             return {
-                id: this.get("id"),
+                _id: this.get("_id"),
                 title: this.get("title"),
                 uri: this.get("uri"),
                 description: this.get("description"),
                 position: this.get("position"),
-                created_by: this.get("created_by").get("id")
-            }
+                created_by: this.get("created_by").get("_id")
+            };
         },
     });
     
@@ -121,14 +121,14 @@
         },
         toJSON: function() {
             return {
-                id: this.get("id"),
+                _id: this.get("_id"),
                 title: this.get("title"),
                 uri: this.get("uri"),
                 description: this.get("description"),
-                from: this.get("from").get("id"),
-                to: this.get("to").get("id"),
-                created_by: this.get("created_by").get("id"),
-            }
+                from: this.get("from").get("_id"),
+                to: this.get("to").get("_id"),
+                created_by: this.get("created_by").get("_id"),
+            };
         },
     });