##// END OF EJS Templates
Fix whitespace
Jason Grout -
Show More
@@ -9,9 +9,9 b' define(['
9 initialize: function() {
9 initialize: function() {
10 this.on("change:widgets", function(model, value, options) {
10 this.on("change:widgets", function(model, value, options) {
11 this.update_bindings(model.previous("widgets") || [], value);
11 this.update_bindings(model.previous("widgets") || [], value);
12 this.update_value(this.get("widgets")[0]);
12 this.update_value(this.get("widgets")[0]);
13 }, this);
13 }, this);
14 this.on("destroy", function(model, collection, options) {
14 this.on("destroy", function(model, collection, options) {
15 this.update_bindings(this.get("widgets"), []);
15 this.update_bindings(this.get("widgets"), []);
16 }, this);
16 }, this);
17 },
17 },
@@ -19,12 +19,12 b' define(['
19 var that = this;
19 var that = this;
20 _.each(oldlist, function(elt) {elt[0].off("change:" + elt[1], null, that);});
20 _.each(oldlist, function(elt) {elt[0].off("change:" + elt[1], null, that);});
21 _.each(newlist, function(elt) {elt[0].on("change:" + elt[1],
21 _.each(newlist, function(elt) {elt[0].on("change:" + elt[1],
22 function(model, value, options) {
22 function(model, value, options) {
23 that.update_value(elt);
23 that.update_value(elt);
24 }, that);
24 }, that);
25 // TODO: register for any destruction handlers
25 // TODO: register for any destruction handlers
26 // to take an item out of the list
26 // to take an item out of the list
27 });
27 });
28 },
28 },
29 update_value: function(elt) {
29 update_value: function(elt) {
30 if (this.updating) {return;}
30 if (this.updating) {return;}
@@ -34,10 +34,10 b' define(['
34 this.updating = true;
34 this.updating = true;
35 _.each(_.without(this.get("widgets"), elt),
35 _.each(_.without(this.get("widgets"), elt),
36 function(element, index, list) {
36 function(element, index, list) {
37 if (element[0]) {
37 if (element[0]) {
38 element[0].set(element[1], new_value);
38 element[0].set(element[1], new_value);
39 element[0].save_changes();
39 element[0].save_changes();
40 }
40 }
41 }, this);
41 }, this);
42 this.updating = false;
42 this.updating = false;
43 },
43 },
@@ -57,7 +57,7 b' define(['
57 this.source[0].off("change:" + this.source[1], null, this);
57 this.source[0].off("change:" + this.source[1], null, this);
58 }
58 }
59 this.source = this.get("source");
59 this.source = this.get("source");
60 if (this.source) {
60 if (this.source) {
61 this.source[0].on("change:" + this.source[1], function() { this.update_value(this.source); }, this);
61 this.source[0].on("change:" + this.source[1], function() { this.update_value(this.source); }, this);
62 this.update_value(this.source);
62 this.update_value(this.source);
63 }
63 }
@@ -70,16 +70,15 b' define(['
70 this.updating = true;
70 this.updating = true;
71 _.each(this.get("targets"),
71 _.each(this.get("targets"),
72 function(element, index, list) {
72 function(element, index, list) {
73 if (element[0]) {
73 if (element[0]) {
74 element[0].set(element[1], new_value);
74 element[0].set(element[1], new_value);
75 element[0].save_changes();
75 element[0].save_changes();
76 }
76 }
77 }, this);
77 }, this);
78 this.updating = false;
78 this.updating = false;
79 },
79 },
80 });
80 });
81
81
82
83 return {
82 return {
84 "LinkModel": LinkModel,
83 "LinkModel": LinkModel,
85 "DirectionalLinkModel": DirectionalLinkModel,
84 "DirectionalLinkModel": DirectionalLinkModel,
General Comments 0
You need to be logged in to leave comments. Login now