client/js/models.js
changeset 212 ee7b5831d382
parent 211 d87f6bdee43d
child 271 b2cc6f238b0d
equal deleted inserted replaced
211:d87f6bdee43d 212:ee7b5831d382
   194             this.get("edges").remove(_model);
   194             this.get("edges").remove(_model);
   195         },
   195         },
   196         validate: function(options) {
   196         validate: function(options) {
   197             var _project = this;
   197             var _project = this;
   198             _(options.users).each(function(_item) {
   198             _(options.users).each(function(_item) {
   199                 _item.project = _project;
   199                 if(_item) {
       
   200                     _item.project = _project;
       
   201                 }
   200             });
   202             });
   201             _(options.nodes).each(function(_item) {
   203             _(options.nodes).each(function(_item) {
   202                 _item.project = _project;
   204                 if(_item) {
       
   205                     _item.project = _project;
       
   206                 }
   203             });
   207             });
   204             _(options.edges).each(function(_item) {
   208             _(options.edges).each(function(_item) {
   205                 _item.project = _project;
   209                 if(_item) {
       
   210                     _item.project = _project;
       
   211                 }
   206             });
   212             });
   207         },
   213         },
   208         // Add event handler to remove edges when a node is removed
   214         // Add event handler to remove edges when a node is removed
   209         initialize: function() {
   215         initialize: function() {
   210             var _this = this;
   216             var _this = this;
   217             });
   223             });
   218         }
   224         }
   219     });
   225     });
   220     
   226     
   221     var RosterUser = Models.RosterUser = Backbone.Model.extend({
   227     var RosterUser = Models.RosterUser = Backbone.Model.extend({
   222         type: "roster_user",               
   228         type: "roster_user",
   223         idAttribute : "_id",
   229         idAttribute : "_id",
   224         
   230         
   225         constructor: function(options) {
   231         constructor: function(options) {
   226             
   232             
   227             if (typeof options !== "undefined") {
   233             if (typeof options !== "undefined") {