diff options
Diffstat (limited to 'js/components')
17 files changed, 206 insertions, 204 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..ac131f2c 100755 --- a/js/components/layout/bread-crumb.reel/bread-crumb.js +++ b/js/components/layout/bread-crumb.reel/bread-crumb.js | |||
@@ -9,21 +9,44 @@ var Montage = require("montage/core/core").Montage, | |||
9 | 9 | ||
10 | exports.Breadcrumb = Montage.create(Component, { | 10 | exports.Breadcrumb = Montage.create(Component, { |
11 | 11 | ||
12 | disabled: { | 12 | _currentDocument: { |
13 | value: true | 13 | enumerable: false, |
14 | value: null | ||
14 | }, | 15 | }, |
15 | 16 | ||
16 | handleOpenDocument: { | 17 | currentDocument: { |
17 | value: function(){ | 18 | enumerable: false, |
18 | this.disabled = 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(!value) { | ||
30 | this.disabled = true; | ||
31 | } else { | ||
32 | this.disabled = this._currentDocument.currentView !== "design"; | ||
33 | } | ||
34 | |||
19 | } | 35 | } |
20 | }, | 36 | }, |
21 | 37 | ||
22 | handleCloseDocument: { | 38 | |
23 | value: function(){ | 39 | _disabled: { |
24 | if(!this.application.ninja.documentController.activeDocument && this.application.ninja.currentDocument.currentView !== "code") { | 40 | value: true |
25 | this.disabled = true; | 41 | }, |
26 | this.application.ninja.currentSelectedContainer = (this.application.ninja.currentDocument ? this.application.ninja.currentDocument.model.documentRoot : null); | 42 | |
43 | disabled: { | ||
44 | get: function() { | ||
45 | return this._disabled; | ||
46 | }, | ||
47 | set: function(value) { | ||
48 | if(value !== this._disabled) { | ||
49 | this._disabled = value; | ||
27 | } | 50 | } |
28 | } | 51 | } |
29 | }, | 52 | }, |
@@ -50,8 +73,6 @@ exports.Breadcrumb = Montage.create(Component, { | |||
50 | 73 | ||
51 | prepareForDraw: { | 74 | prepareForDraw: { |
52 | value: function() { | 75 | value: function() { |
53 | this.eventManager.addEventListener("openDocument", this, false); | ||
54 | this.eventManager.addEventListener("closeDocument", this, false); | ||
55 | this.breadcrumbBt.addEventListener("action", this, false); | 76 | this.breadcrumbBt.addEventListener("action", this, false); |
56 | } | 77 | } |
57 | }, | 78 | }, |
@@ -65,7 +86,7 @@ exports.Breadcrumb = Montage.create(Component, { | |||
65 | 86 | ||
66 | parentNode = this.container; | 87 | parentNode = this.container; |
67 | 88 | ||
68 | while(parentNode !== this.application.ninja.currentDocument.model.documentRoot) { | 89 | while(parentNode !== this.currentDocument.model.documentRoot) { |
69 | this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName}); | 90 | this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName}); |
70 | parentNode = parentNode.parentNode; | 91 | parentNode = parentNode.parentNode; |
71 | } | 92 | } |
@@ -87,6 +108,7 @@ exports.Breadcrumb = Montage.create(Component, { | |||
87 | this.containerElements.pop(); | 108 | this.containerElements.pop(); |
88 | } | 109 | } |
89 | 110 | ||
111 | // TODO: This is bound 2 ways, update the internal property | ||
90 | this.application.ninja.currentSelectedContainer = this.containerElements[i].node; | 112 | this.application.ninja.currentSelectedContainer = this.containerElements[i].node; |
91 | } | 113 | } |
92 | } | 114 | } |
diff --git a/js/components/layout/document-bar.reel/document-bar.html b/js/components/layout/document-bar.reel/document-bar.html index 760186ba..a35b5590 100755 --- a/js/components/layout/document-bar.reel/document-bar.html +++ b/js/components/layout/document-bar.reel/document-bar.html | |||
@@ -37,11 +37,7 @@ | |||
37 | "element": {"#": "disabledCondition"} | 37 | "element": {"#": "disabledCondition"} |
38 | }, | 38 | }, |
39 | "bindings": { | 39 | "bindings": { |
40 | "condition": { | 40 | "condition": {"<-": "@owner.disabled"} |
41 | "boundObject": {"@": "owner"}, | ||
42 | "boundObjectPropertyPath": "disabled", | ||
43 | "oneway": true | ||
44 | } | ||
45 | } | 41 | } |
46 | }, | 42 | }, |
47 | 43 | ||
diff --git a/js/components/layout/document-bar.reel/document-bar.js b/js/components/layout/document-bar.reel/document-bar.js index 56b61f1d..90d3a207 100755 --- a/js/components/layout/document-bar.reel/document-bar.js +++ b/js/components/layout/document-bar.reel/document-bar.js | |||
@@ -9,13 +9,32 @@ var Component = require("montage/ui/component").Component; | |||
9 | 9 | ||
10 | exports.DocumentBar = Montage.create(Component, { | 10 | exports.DocumentBar = Montage.create(Component, { |
11 | 11 | ||
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 | this.disabled = !this._currentDocument; | ||
30 | |||
31 | } | ||
32 | }, | ||
33 | |||
12 | designView: { value: null, enumerable: false}, | 34 | designView: { value: null, enumerable: false}, |
13 | codeView: { value: null, enumerable: false}, | 35 | codeView: { value: null, enumerable: false}, |
14 | zoomControl: { value: null, enumerable: false }, | 36 | zoomControl: { value: null, enumerable: false }, |
15 | _type: { enumerable: false, value: null }, | 37 | _type: { enumerable: false, value: null }, |
16 | disabled: { value: true }, | ||
17 | |||
18 | |||
19 | 38 | ||
20 | type: { | 39 | type: { |
21 | enumerable: false, | 40 | enumerable: false, |
@@ -86,40 +105,34 @@ exports.DocumentBar = Montage.create(Component, { | |||
86 | 105 | ||
87 | prepareForDraw: { | 106 | prepareForDraw: { |
88 | value: function() { | 107 | value: function() { |
89 | this.eventManager.addEventListener( "openDocument", this, false); | ||
90 | this.eventManager.addEventListener( "closeDocument", this, false); | ||
91 | this.designView.addEventListener("click", this, false); | 108 | this.designView.addEventListener("click", this, false); |
92 | this.codeView.addEventListener("click", this, false); | 109 | this.codeView.addEventListener("click", this, false); |
93 | 110 | ||
94 | } | 111 | } |
95 | }, | 112 | }, |
96 | 113 | ||
97 | handleClick: { | 114 | _disabled: { |
98 | value: function(event) { | 115 | value: true |
99 | if(event._event.target.id === this.currentView) return; | ||
100 | |||
101 | this.currentView = event._event.target.id; | ||
102 | this.application.ninja.documentController.stage.stageView.switchDesignDocViews(event._event.target.id);//switch between design view | ||
103 | } | ||
104 | }, | ||
105 | |||
106 | handleOpenDocument: { | ||
107 | value: function() { | ||
108 | this.disabled = false; | ||
109 | } | ||
110 | }, | 116 | }, |
111 | 117 | ||
112 | handleCloseDocument: { | 118 | disabled: { |
113 | value: function() { | 119 | get: function() { |
114 | if(!this.application.ninja.documentController.activeDocument) { | 120 | return this._disabled; |