aboutsummaryrefslogtreecommitdiff
path: root/js/components/layout/bread-crumb.reel
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-02-22 10:34:46 -0800
committerNivesh Rajbhandari2012-02-22 10:34:46 -0800
commit50bb05efbafc9a80f069dfde32988e5cd6826865 (patch)
tree64332f1c2f22b5c0a17f6df2f9a02d77f1c87274 /js/components/layout/bread-crumb.reel
parenta69c929602e64f10fb3903b89a2ca9e9ed2c8dfb (diff)
parent2f24dafec79583547fe663d5a387d8ef15aae3bf (diff)
downloadninja-50bb05efbafc9a80f069dfde32988e5cd6826865.tar.gz
Merge branch 'refs/heads/ninja-internal' into ToolFixes
Diffstat (limited to 'js/components/layout/bread-crumb.reel')
-rwxr-xr-xjs/components/layout/bread-crumb.reel/bread-crumb.js112
1 files changed, 30 insertions, 82 deletions
diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js
index ead7c764..1290aaac 100755
--- a/js/components/layout/bread-crumb.reel/bread-crumb.js
+++ b/js/components/layout/bread-crumb.reel/bread-crumb.js
@@ -1,6 +1,6 @@
1 1
2var Montage = require("montage/core/core").Montage 2var Montage = require("montage/core/core").Montage,
3var Component = require("montage/ui/component").Component 3 Component = require("montage/ui/component").Component;
4 4
5var Breadcrumb = exports.Breadcrumb = Montage.create(Component, { 5var Breadcrumb = exports.Breadcrumb = Montage.create(Component, {
6 6
@@ -8,15 +8,12 @@ var Breadcrumb = exports.Breadcrumb = Montage.create(Component, {
8 value:null 8 value:null
9 }, 9 },
10 10
11
12 container: { 11 container: {
13 set: function(value) { 12 set: function(value) {
14 if(this._container !== value) { 13 if(this._container !== value) {
15 this._container = value; 14 this._container = value;
16 this.createContainerElements(); 15 this.createContainerElements();
17 } 16 }
18
19
20 }, 17 },
21 get: function() { 18 get: function() {
22 return this._container; 19 return this._container;
@@ -25,7 +22,6 @@ var Breadcrumb = exports.Breadcrumb = Montage.create(Component, {
25 22
26 containerElements: { 23 containerElements: {
27 value: [] 24 value: []
28
29 }, 25 },
30 26
31 27
@@ -33,14 +29,12 @@ var Breadcrumb = exports.Breadcrumb = Montage.create(Component, {
33 value: function() { 29 value: function() {
34 this.eventManager.addEventListener( "appLoaded", this, false); 30 this.eventManager.addEventListener( "appLoaded", this, false);
35 this.eventManager.addEventListener( "breadCrumbTrail", this, false); 31 this.eventManager.addEventListener( "breadCrumbTrail", this, false);
36 }, 32 }
37 enumerable : false
38 }, 33 },
39 34
40 handleAppLoaded : { 35 handleAppLoaded : {
41 value: function() { 36 value: function() {
42 37
43
44 Object.defineBinding(this, "container", { 38 Object.defineBinding(this, "container", {
45 boundObject: this.application.ninja, 39 boundObject: this.application.ninja,
46 boundObjectPropertyPath: "currentSelectedContainer", 40 boundObjectPropertyPath: "currentSelectedContainer",
@@ -50,107 +44,61 @@ var Breadcrumb = exports.Breadcrumb = Montage.create(Component, {
50 } 44 }
51 }, 45 },
52 46
53 prepareForDraw: {
54 value: function() {
55
56 }
57 },
58
59 draw: {
60 value: function() {
61
62 }
63 },
64
65 didDraw:{
66 value:function(){
67 }
68 },
69
70 createContainerElements: { 47 createContainerElements: {
71 value: function() { 48 value: function() {
72
73 var parentNode; 49 var parentNode;
74 50
75 while(this.containerElements.pop()){ 51 this.containerElements.length = 0
76 // To empty the array to get the new parentNode of the new currentLevel
77 }
78
79 if(this.container.id === "UserContent"){
80
81 this.containerElements.push({selected:false,element:this.container});
82
83 52
84 } 53 if(this.container.id === "UserContent") {
85 else{ 54 this.containerElements.push({selected:false, element:this.container});
86 55 } else {
87 parentNode= this.container; 56 parentNode = this.container;
88
89 while(parentNode.id!=="UserContent"){
90
91 this.containerElements.unshift ({selected:false,element:parentNode});
92 parentNode=parentNode.parentNode;
93 57
94 } 58 while(parentNode.id!=="UserContent") {
95 59 this.containerElements.unshift({selected:false,element:parentNode});
96 this.containerElements.unshift({selected:false,element:parentNode}); 60 parentNode = parentNode.parentNode;
61 }
97 62
63 this.containerElements.unshift({selected:false,element:parentNode});
98 } 64 }
99 65
100 NJevent('layerBinding',{selected:false ,element:this.container}) 66 NJevent('layerBinding',{selected:false ,element:this.container})
101
102
103 } 67 }
104 }, 68 },
105 69
106 70 handleBreadCrumbTrail: {
107 handleBreadCrumbTrail: {
108 value: function(event) { 71 value: function(event) {
72 var newLength,revaluatedLength,tmpvalue;
73 var i=0;
109 74
110 var newLength,revaluatedLength,tmpvalue 75 if(event.detail.setFlag ){
111 var i=0; 76 this.application.ninja.currentSelectedContainer = event.detail.element;
112 if(event.detail.setFlag){ 77 return;
113 this.application.ninja.currentSelectedContainer = event.detail.element;
114 return;
115 } 78 }
116 79
117 newLength = this.containerElements.length; 80 newLength = this.containerElements.length;
118 81
119 while(i < newLength ){ 82 while(i < newLength ){
120 83 if(this.containerElements[i].selected){
121 if(this.containerElements[i].selected){ 84 tmpvalue = i;
122 85 break;
123 tmpvalue = i ; 86 }
124 break;
125
126 }
127
128 i++; 87 i++;
129 } 88 }
130 89
131 90 for(i = newLength -1 ; i >= 1 ; i--) {
132 91 if(tmpvalue !== i) {
133 for(i = newLength -1 ; i >= 1 ; i--){
134
135 if(tmpvalue!==i){
136
137 this.containerElements.pop(); 92 this.containerElements.pop();
138 } 93 } else {
139
140 else{
141
142 break; 94 break;
143 } 95 }
144
145 } 96 }
146 97
147 revaluatedLength = this.containerElements.length; 98 revaluatedLength = this.containerElements.length;
148 this.application.ninja.currentSelectedContainer = this.containerElements[revaluatedLength-1].element; 99 this.application.ninja.currentSelectedContainer = this.containerElements[revaluatedLength-1].element;
149 100
150
151 } 101 }
152 } 102 }
153
154
155}); 103});
156 104