aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorArmen Kesablyan2012-06-25 16:56:06 -0700
committerArmen Kesablyan2012-06-25 16:56:06 -0700
commit199dd0149b5b328b52cafd5ecb07a120aa1473a7 (patch)
tree46aa1229e2cc1ab37b807946ec82cae3cccbcebd /js
parentb73e0aa2cffa3ffd2b574645f6ec88dc34726caa (diff)
downloadninja-199dd0149b5b328b52cafd5ecb07a120aa1473a7.tar.gz
Binding View - Objects Replace existing source Object if it exists
Signed-off-by: Armen Kesablyan <armen@motorola.com>
Diffstat (limited to 'js')
-rw-r--r--js/controllers/objects-controller.js10
-rw-r--r--js/panels/binding/edit-binding-view.reel/edit-binding-view.js1
2 files changed, 10 insertions, 1 deletions
diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js
index 3e35ef5f..6557c14e 100644
--- a/js/controllers/objects-controller.js
+++ b/js/controllers/objects-controller.js
@@ -58,7 +58,15 @@ var objectsController = exports.ObjectsController = Montage.create(Montage, {
58 value: function(bindingArgs) { 58 value: function(bindingArgs) {
59 if(!bindingArgs.sourceObject || !bindingArgs.sourceObjectPropertyPath || !bindingArgs) { return; } 59 if(!bindingArgs.sourceObject || !bindingArgs.sourceObjectPropertyPath || !bindingArgs) { return; }
60 60
61 Object.defineBinding(bindingArgs.sourceObject, bindingArgs.sourceObjectPropertyPath, bindingArgs); 61 var sourceObject = bindingArgs.sourceObject,
62 sourcePath = bindingArgs.sourceObjectPropertyPath,
63 sourceDescriptor = sourceObject._bindingDescriptors;
64
65 if(sourceDescriptor && sourceDescriptor[sourcePath]) {
66 this.removeBinding(bindingArgs);
67 }
68
69 Object.defineBinding(sourceObject, sourcePath, bindingArgs);
62 this.currentObjectBindings = this.getObjectBindings(bindingArgs.sourceObject); 70 this.currentObjectBindings = this.getObjectBindings(bindingArgs.sourceObject);
63 } 71 }
64 }, 72 },
diff --git a/js/panels/binding/edit-binding-view.reel/edit-binding-view.js b/js/panels/binding/edit-binding-view.reel/edit-binding-view.js
index 4b20f74a..90fa30ba 100644
--- a/js/panels/binding/edit-binding-view.reel/edit-binding-view.js
+++ b/js/panels/binding/edit-binding-view.reel/edit-binding-view.js
@@ -216,6 +216,7 @@ var editBindingView = exports.EditBindingView = Montage.create(Component, {
216 boundObjectPropertyPath : this.boundObjectPropertyPath, 216 boundObjectPropertyPath : this.boundObjectPropertyPath,
217 oneway: this.oneway 217 oneway: this.oneway
218 }; 218 };
219 debugger;
219 220
220 if(this.isNewBinding) { 221 if(this.isNewBinding) {
221 controller.addBinding(newBindingArgs); 222 controller.addBinding(newBindingArgs);