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