diff options
author | Jose Antonio Marquez | 2012-06-12 09:47:52 -0700 |
---|---|---|
committer | Jose Antonio Marquez | 2012-06-12 09:47:52 -0700 |
commit | 5a46f92f3127f7cc7870f125e8da2b44c2891fd0 (patch) | |
tree | 5604e15409ade61bf8b68bf0a5a2401edff1a0ee /js/components/layout/bread-crumb.reel | |
parent | 19c77d87df72a85345e527d790878fc65eca189a (diff) | |
parent | 6854a72504f57903bd5de003e377f2aefb02d0da (diff) | |
download | ninja-5a46f92f3127f7cc7870f125e8da2b44c2891fd0.tar.gz |
Merge branch 'refs/heads/Ninja-Internal' into TempPromptUI
Diffstat (limited to 'js/components/layout/bread-crumb.reel')
-rwxr-xr-x | js/components/layout/bread-crumb.reel/bread-crumb.js | 42 |
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 ac131f2c..260922b3 100755 --- a/js/components/layout/bread-crumb.reel/bread-crumb.js +++ b/js/components/layout/bread-crumb.reel/bread-crumb.js | |||
@@ -51,22 +51,6 @@ exports.Breadcrumb = Montage.create(Component, { | |||
51 | } | 51 | } |
52 | }, | 52 | }, |
53 | 53 | ||
54 | _container:{ | ||
55 | value:null | ||
56 | }, | ||
57 | |||
58 | container: { | ||
59 | set: function(value) { | ||
60 | if(this._container !== value) { | ||
61 | this._container = value; | ||
62 | this.createContainerElements(); | ||
63 | } | ||
64 | }, | ||
65 | get: function() { | ||
66 | return this._container; | ||
67 | } | ||
68 | }, | ||
69 | |||
70 | containerElements: { | 54 | containerElements: { |
71 | value: [] | 55 | value: [] |
72 | }, | 56 | }, |
@@ -74,31 +58,37 @@ exports.Breadcrumb = Montage.create(Component, { | |||
74 | prepareForDraw: { | 58 | prepareForDraw: { |
75 | value: function() { | 59 | value: function() { |
76 | this.breadcrumbBt.addEventListener("action", this, false); | 60 | this.breadcrumbBt.addEventListener("action", this, false); |
61 | this.addPropertyChangeListener("currentDocument.model.domContainer", this) | ||
77 | } | 62 | } |
78 | }, | 63 | }, |
79 | 64 | ||
80 | createContainerElements: { | 65 | handleChange: { |
81 | value: function() { | 66 | value: function() { |
82 | var parentNode; | 67 | if(this.currentDocument && this.currentDocument.model.getProperty("domContainer")) { |
68 | this.createContainerElements(this.currentDocument.model.getProperty("domContainer")); | ||
69 | } | ||
70 | } | ||
71 | }, | ||
72 | |||
73 | createContainerElements: { | ||
74 | value: function(container) { | ||
83 | 75 | ||
84 | // delete this.containerElements; | 76 | // delete this.containerElements; |
85 | this.containerElements = []; | 77 | this.containerElements = []; |
86 | 78 | ||
87 | parentNode = this.container; | 79 | while(container !== this.currentDocument.model.documentRoot) { |
88 | 80 | this.containerElements.unshift({"node": container, "nodeUuid":container.uuid, "label": container.nodeName}); | |
89 | while(parentNode !== this.currentDocument.model.documentRoot) { | 81 | container = container.parentNode; |
90 | this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName}); | ||
91 | parentNode = parentNode.parentNode; | ||
92 | } | 82 | } |
93 | 83 | ||
94 | // This is always the top container which is now hardcoded to body | 84 | // This is always the top container which is now hardcoded to body |
95 | this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName}); | 85 | this.containerElements.unshift({"node": container, "nodeUuid":container.uuid, "label": container.nodeName}); |
96 | } | 86 | } |
97 | }, | 87 | }, |
98 | 88 | ||
99 | handleAction: { | 89 | handleAction: { |
100 | value: function(evt) { | 90 | value: function(evt) { |
101 | if(evt.target.value === this.container.uuid) { | 91 | if(evt.target.value === this.currentDocument.model.domContainer.uuid) { |
102 | return; | 92 | return; |
103 | } | 93 | } |
104 | 94 | ||
@@ -109,7 +99,7 @@ exports.Breadcrumb = Montage.create(Component, { | |||
109 | } | 99 | } |
110 | 100 | ||
111 | // TODO: This is bound 2 ways, update the internal property | 101 | // TODO: This is bound 2 ways, update the internal property |
112 | this.application.ninja.currentSelectedContainer = this.containerElements[i].node; | 102 | this.currentDocument.model.domContainer = this.containerElements[i].node; |
113 | } | 103 | } |
114 | } | 104 | } |
115 | }); | 105 | }); |