aboutsummaryrefslogtreecommitdiff
path: root/js/components/layout/bread-crumb.reel/bread-crumb.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/components/layout/bread-crumb.reel/bread-crumb.js')
-rwxr-xr-xjs/components/layout/bread-crumb.reel/bread-crumb.js44
1 files changed, 38 insertions, 6 deletions
diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js
index 49dbe3cb..74e89ac1 100755
--- a/js/components/layout/bread-crumb.reel/bread-crumb.js
+++ b/js/components/layout/bread-crumb.reel/bread-crumb.js
@@ -9,13 +9,45 @@ var Montage = require("montage/core/core").Montage,
9 9
10exports.Breadcrumb = Montage.create(Component, { 10exports.Breadcrumb = Montage.create(Component, {
11 11
12 disabled: { 12 _currentDocument: {
13 enumerable: false,
14 value: null
15 },
16
17 currentDocument: {
18 enumerable: false,
19 get: function() {
20 return this._currentDocument;
21 },
22 set: function(value) {
23 if (value === this._currentDocument) {
24 return;
25 }
26
27 this._currentDocument = value;
28
29 if(!this._currentDocument) {
30 this.disabled = true;
31 }
32
33 this.disabled = this._currentDocument.currentView !== "design";
34
35 }
36 },
37
38
39 _disabled: {
13 value: true 40 value: true
14 }, 41 },
15 42
16 handleOpenDocument: { 43 disabled: {
17 value: function(){ 44 get: function() {
18 this.disabled = false; 45 return this._disabled;
46 },
47 set: function(value) {
48 if(value !== this._disabled) {
49 this._disabled = value;
50 }
19 } 51 }
20 }, 52 },
21 53
@@ -50,7 +82,6 @@ exports.Breadcrumb = Montage.create(Component, {
50 82
51 prepareForDraw: { 83 prepareForDraw: {
52 value: function() { 84 value: function() {
53 this.eventManager.addEventListener("openDocument", this, false);
54 this.eventManager.addEventListener("closeDocument", this, false); 85 this.eventManager.addEventListener("closeDocument", this, false);
55 this.breadcrumbBt.addEventListener("action", this, false); 86 this.breadcrumbBt.addEventListener("action", this, false);
56 } 87 }
@@ -65,7 +96,7 @@ exports.Breadcrumb = Montage.create(Component, {
65 96
66 parentNode = this.container; 97 parentNode = this.container;
67 98
68 while(parentNode !== this.application.ninja.currentDocument.model.documentRoot) { 99 while(parentNode !== this.currentDocument.model.documentRoot) {
69 this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName}); 100 this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName});
70 parentNode = parentNode.parentNode; 101 parentNode = parentNode.parentNode;
71 } 102 }
@@ -87,6 +118,7 @@ exports.Breadcrumb = Montage.create(Component, {
87 this.containerElements.pop(); 118 this.containerElements.pop();
88 } 119 }
89 120
121 // TODO: This is bound 2 ways, update the internal property
90 this.application.ninja.currentSelectedContainer = this.containerElements[i].node; 122 this.application.ninja.currentSelectedContainer = this.containerElements[i].node;
91 } 123 }
92 } 124 }