aboutsummaryrefslogtreecommitdiff
path: root/js/components/layout/bread-crumb.reel/bread-crumb.js
diff options
context:
space:
mode:
authorValerio Virgillito2012-06-11 17:46:29 -0700
committerValerio Virgillito2012-06-11 17:46:29 -0700
commitb6c88f548c8d3756738e534418732710af733f03 (patch)
treed651ce2811019a3bccfd8be1326762cd2c601316 /js/components/layout/bread-crumb.reel/bread-crumb.js
parent91123fef348ec54d89005adbc151e816856a6a18 (diff)
parent6854a72504f57903bd5de003e377f2aefb02d0da (diff)
downloadninja-b6c88f548c8d3756738e534418732710af733f03.tar.gz
Merge branch 'refs/heads/master' into montage-v10-integration
Conflicts: js/io/system/ninjalibrary.json js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/components/layout/bread-crumb.reel/bread-crumb.js')
-rwxr-xr-xjs/components/layout/bread-crumb.reel/bread-crumb.js42
1 files changed, 16 insertions, 26 deletions
diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js
index d525c813..2f493102 100755
--- a/js/components/layout/bread-crumb.reel/bread-crumb.js
+++ b/js/components/layout/bread-crumb.reel/bread-crumb.js
@@ -56,22 +56,6 @@ exports.Breadcrumb = Montage.create(Component, {
56 } 56 }
57 }, 57 },
58 58
59 _container:{
60 value:null
61 },
62
63 container: {
64 set: function(value) {
65 if(this._container !== value) {
66 this._container = value;
67 this.createContainerElements();
68 }
69 },
70 get: function() {
71 return this._container;
72 }
73 },
74
75 containerElements: { 59 containerElements: {
76 value: [] 60 value: []
77 }, 61 },
@@ -79,31 +63,37 @@ exports.Breadcrumb = Montage.create(Component, {
79 prepareForDraw: { 63 prepareForDraw: {
80 value: function() { 64 value: function() {
81 this.breadcrumbBt.addEventListener("action", this, false); 65 this.breadcrumbBt.addEventListener("action", this, false);
66 this.addPropertyChangeListener("currentDocument.model.domContainer", this)
82 } 67 }
83 }, 68 },
84 69
85 createContainerElements: { 70 handleChange: {
86 value: function() { 71 value: function() {
87 var parentNode; 72 if(this.currentDocument && this.currentDocument.model.getProperty("domContainer")) {
73 this.createContainerElements(this.currentDocument.model.getProperty("domContainer"));
74 }
75 }
76 },
77
78 createContainerElements: {
79 value: function(container) {
88 80
89// delete this.containerElements; 81// delete this.containerElements;
90 this.containerElements = []; 82 this.containerElements = [];
91 83
92 parentNode = this.container; 84 while(container !== this.currentDocument.model.documentRoot) {
93 85 this.containerElements.unshift({"node": container, "nodeUuid":container.uuid, "label": container.nodeName});
94 while(parentNode !== this.currentDocument.model.documentRoot) { 86 container = container.parentNode;
95 this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName});
96 parentNode = parentNode.parentNode;
97 } 87 }
98 88
99 // This is always the top container which is now hardcoded to body 89 // This is always the top container which is now hardcoded to body
100 this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName}); 90 this.containerElements.unshift({"node": container, "nodeUuid":container.uuid, "label": container.nodeName});
101 } 91 }
102 }, 92 },
103 93
104 handleAction: { 94 handleAction: {
105 value: function(evt) { 95 value: function(evt) {
106 if(evt.target.value === this.container.uuid) { 96 if(evt.target.value === this.currentDocument.model.domContainer.uuid) {
107 return; 97 return;
108 } 98 }
109 99
@@ -114,7 +104,7 @@ exports.Breadcrumb = Montage.create(Component, {
114 } 104 }
115 105
116 // TODO: This is bound 2 ways, update the internal property 106 // TODO: This is bound 2 ways, update the internal property
117 this.application.ninja.currentSelectedContainer = this.containerElements[i].node; 107 this.currentDocument.model.domContainer = this.containerElements[i].node;
118 } 108 }
119 } 109 }
120}); 110});