92 title : this.get("title"), |
92 title : this.get("title"), |
93 uri : this.get("uri"), |
93 uri : this.get("uri"), |
94 description : this.get("description"), |
94 description : this.get("description"), |
95 position : this.get("position"), |
95 position : this.get("position"), |
96 image : this.get("image"), |
96 image : this.get("image"), |
97 color : this.get("color"), |
97 style : this.get("style"), |
98 created_by : this.get("created_by") ? this.get("created_by") |
98 created_by : this.get("created_by") ? this.get("created_by") |
99 .get("_id") : null, |
99 .get("_id") : null, |
100 size : this.get("size"), |
100 size : this.get("size"), |
101 clip_path : this.get("clip_path"), |
101 clip_path : this.get("clip_path"), |
102 shape : this.get("shape"), |
102 shape : this.get("shape"), |
136 title : this.get("title"), |
136 title : this.get("title"), |
137 uri : this.get("uri"), |
137 uri : this.get("uri"), |
138 description : this.get("description"), |
138 description : this.get("description"), |
139 from : this.get("from") ? this.get("from").get("_id") : null, |
139 from : this.get("from") ? this.get("from").get("_id") : null, |
140 to : this.get("to") ? this.get("to").get("_id") : null, |
140 to : this.get("to") ? this.get("to").get("_id") : null, |
141 color : this.get("color"), |
141 style : this.get("style"), |
142 created_by : this.get("created_by") ? this.get("created_by") |
142 created_by : this.get("created_by") ? this.get("created_by") |
143 .get("_id") : null |
143 .get("_id") : null |
144 }; |
144 }; |
145 } |
145 } |
146 }); |
146 }); |
188 } |
188 } |
189 }); |
189 }); |
190 |
190 |
191 // PROJECT |
191 // PROJECT |
192 var Project = Models.Project = RenkanModel.extend({ |
192 var Project = Models.Project = RenkanModel.extend({ |
193 schemaVersion : "1", |
193 schema_version : "2", |
194 type : "project", |
194 type : "project", |
195 blacklist : [ 'saveStatus', 'loadingStatus',], |
195 blacklist : [ 'saveStatus', 'loadingStatus'], |
196 relations : [ { |
196 relations : [ { |
197 type : Backbone.HasMany, |
197 type : Backbone.HasMany, |
198 key : "users", |
198 key : "users", |
199 relatedModel : User, |
199 relatedModel : User, |
200 reverseRelation : { |
200 reverseRelation : { |
294 })); |
294 })); |
295 }); |
295 }); |
296 }, |
296 }, |
297 toJSON : function() { |
297 toJSON : function() { |
298 var json = _.clone(this.attributes); |
298 var json = _.clone(this.attributes); |
299 json.schema_version = this.schemaVersion; |
|
300 for ( var attr in json) { |
299 for ( var attr in json) { |
301 if ((json[attr] instanceof Backbone.Model) || |
300 if ((json[attr] instanceof Backbone.Model) || |
302 (json[attr] instanceof Backbone.Collection) || |
301 (json[attr] instanceof Backbone.Collection) || |
303 (json[attr] instanceof RenkanModel)) { |
302 (json[attr] instanceof RenkanModel)) { |
304 json[attr] = json[attr].toJSON(); |
303 json[attr] = json[attr].toJSON(); |