client/js/models.js
changeset 455 18b9be54174d
parent 449 aae670254c49
parent 444 19f0b7803aed
child 461 48235ed6b07d
--- a/client/js/models.js	Fri May 22 17:50:10 2015 +0200
+++ b/client/js/models.js	Tue Jun 02 16:42:02 2015 +0200
@@ -1,6 +1,5 @@
-(function() {
+(function(root) {
     "use strict";
-    var root = this;
 
     var Backbone = root.Backbone;
 
@@ -191,8 +190,9 @@
 
     // PROJECT
     var Project = Models.Project = RenkanModel.extend({
+        schemaVersion : "1",
         type : "project",
-        blacklist : [ 'save_status', ],
+        blacklist : [ 'saveStatus', 'loadingStatus',],
         relations : [ {
             type : Backbone.HasMany,
             key : "users",
@@ -269,6 +269,19 @@
               }
             );
         },
+        getSchemaVersion : function(data) {
+          var t = data;
+          if(typeof(t) === "undefined") {
+            t = this;
+          }
+          var version = t.schemaVersion;
+          if(!version) {
+            return 1;
+          }
+          else {
+            return version;
+          }
+        },
         // Add event handler to remove edges when a node is removed
         initialize : function() {
             var _this = this;
@@ -283,6 +296,7 @@
         },
         toJSON : function() {
             var json = _.clone(this.attributes);
+            json.schema_version = this.schemaVersion;
             for ( var attr in json) {
                 if ((json[attr] instanceof Backbone.Model) ||
                         (json[attr] instanceof Backbone.Collection) ||
@@ -347,4 +361,4 @@
         model : RosterUser
     });
 
-}).call(window);
+})(window);