aboutsummaryrefslogtreecommitdiff
path: root/js/components/layout/bread-crumb.reel
diff options
context:
space:
mode:
authorArmen Kesablyan2012-06-19 01:03:59 -0700
committerArmen Kesablyan2012-06-19 01:03:59 -0700
commit2e13a73e4ee980a6f73f6ff48b2a195eb209a7db (patch)
treed352f5e769eae0e1b7b76ccbeafa9b174b1a9918 /js/components/layout/bread-crumb.reel
parent244e608645778746d1a3b5aa0d4c0868f7c5c272 (diff)
parentc59eb371559a3061ce53223e249ca97daace5968 (diff)
downloadninja-2e13a73e4ee980a6f73f6ff48b2a195eb209a7db.tar.gz
Merge branch 'refs/heads/master' into binding
Conflicts: js/components/layout/tools-list.reel/tools-list.html js/components/layout/tools-properties.reel/tools-properties.html js/document/document-html.js js/document/templates/app/main.js js/panels/Panel.reel/Panel.js node_modules/montage/ui/native-control.js Signed-off-by: Armen Kesablyan <armen@motorola.com>
Diffstat (limited to 'js/components/layout/bread-crumb.reel')
-rwxr-xr-xjs/components/layout/bread-crumb.reel/bread-crumb.html2
-rwxr-xr-xjs/components/layout/bread-crumb.reel/bread-crumb.js48
2 files changed, 23 insertions, 27 deletions
diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.html b/js/components/layout/bread-crumb.reel/bread-crumb.html
index 0dabc781..68f3be2b 100755
--- a/js/components/layout/bread-crumb.reel/bread-crumb.html
+++ b/js/components/layout/bread-crumb.reel/bread-crumb.html
@@ -40,7 +40,7 @@
40 "buttonsListController": { 40 "buttonsListController": {
41 "prototype": "montage/ui/controller/array-controller", 41 "prototype": "montage/ui/controller/array-controller",
42 "bindings": { 42 "bindings": {
43 "content": {"<<->": "@owner.containerElements"} 43 "content": {"<->": "@owner.containerElements"}
44 } 44 }
45 }, 45 },
46 46
diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js
index ac131f2c..a3c743a4 100755
--- a/js/components/layout/bread-crumb.reel/bread-crumb.js
+++ b/js/components/layout/bread-crumb.reel/bread-crumb.js
@@ -9,6 +9,11 @@ var Montage = require("montage/core/core").Montage,
9 9
10exports.Breadcrumb = Montage.create(Component, { 10exports.Breadcrumb = Montage.create(Component, {
11 11
12 breadcrumbBt: {
13 value: null,
14 serializable: true
15 },
16
12 _currentDocument: { 17 _currentDocument: {
13 enumerable: false, 18 enumerable: false,
14 value: null 19 value: null
@@ -51,22 +56,6 @@ exports.Breadcrumb = Montage.create(Component, {
51 } 56 }
52 }, 57 },
53 58
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: { 59 containerElements: {
71 value: [] 60 value: []
72 }, 61 },
@@ -74,31 +63,37 @@ exports.Breadcrumb = Montage.create(Component, {
74 prepareForDraw: { 63 prepareForDraw: {
75 value: function() { 64 value: function() {
76 this.breadcrumbBt.addEventListener("action", this, false); 65 this.breadcrumbBt.addEventListener("action", this, false);
66 this.addPropertyChangeListener("currentDocument.model.domContainer", this)
77 } 67 }
78 }, 68 },
79 69
80 createContainerElements: { 70 handleChange: {
81 value: function() { 71 value: function() {
82 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) {
83 80
84// delete this.containerElements; 81// delete this.containerElements;
85 this.containerElements = []; 82 this.containerElements = [];
86 83
87 parentNode = this.container; 84 while(container !== this.currentDocument.model.documentRoot) {
88 85 this.containerElements.unshift({"node": container, "nodeUuid":container.uuid, "label": container.nodeName});
89 while(parentNode !== this.currentDocument.model.documentRoot) { 86 container = container.parentNode;
90 this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName});
91 parentNode = parentNode.parentNode;
92 } 87 }
93 88
94 // 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
95 this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName}); 90 this.containerElements.unshift({"node": container, "nodeUuid":container.uuid, "label": container.nodeName});
96 } 91 }
97 }, 92 },
98 93
99 handleAction: { 94 handleAction: {
100 value: function(evt) { 95 value: function(evt) {
101 if(evt.target.value === this.container.uuid) { 96 if(evt.target.value === this.currentDocument.model.domContainer.uuid) {
102 return; 97 return;
103 } 98 }
104 99
@@ -109,7 +104,8 @@ exports.Breadcrumb = Montage.create(Component, {
109 } 104 }
110 105
111 // TODO: This is bound 2 ways, update the internal property 106 // TODO: This is bound 2 ways, update the internal property
112 this.application.ninja.currentSelectedContainer = this.containerElements[i].node; 107 this.currentDocument.model.domContainer = this.containerElements[i].node;
108 this.application.ninja.selectionController.executeSelectElement();
113 } 109 }
114 } 110 }
115}); 111});