diff options
author | Valerio Virgillito | 2012-02-29 15:04:36 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-02-29 15:04:36 -0800 |
commit | b09956e4a9a35c5588cc7cd1f01efb617cbe0884 (patch) | |
tree | 49b07dfb52252ac986c567ad5c3a7c39ebcc86e2 /js/components/layout/bread-crumb.reel/bread-crumb.js | |
parent | 551e1f2be11e9e6ab7af17816396b88aafd57dff (diff) | |
parent | 2b9f63089534356607ad7e0ddde6f22e42d04f80 (diff) | |
download | ninja-b09956e4a9a35c5588cc7cd1f01efb617cbe0884.tar.gz |
Merge branch 'refs/heads/integration-candidate'
Diffstat (limited to 'js/components/layout/bread-crumb.reel/bread-crumb.js')
-rwxr-xr-x | js/components/layout/bread-crumb.reel/bread-crumb.js | 74 |
1 files changed, 21 insertions, 53 deletions
diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js index 1824c7c3..b2fa42b1 100755 --- a/js/components/layout/bread-crumb.reel/bread-crumb.js +++ b/js/components/layout/bread-crumb.reel/bread-crumb.js | |||
@@ -7,7 +7,7 @@ | |||
7 | var Montage = require("montage/core/core").Montage, | 7 | var Montage = require("montage/core/core").Montage, |
8 | Component = require("montage/ui/component").Component; | 8 | Component = require("montage/ui/component").Component; |
9 | 9 | ||
10 | var Breadcrumb = exports.Breadcrumb = Montage.create(Component, { | 10 | exports.Breadcrumb = Montage.create(Component, { |
11 | 11 | ||
12 | _container:{ | 12 | _container:{ |
13 | value:null | 13 | value:null |
@@ -29,23 +29,9 @@ var Breadcrumb = exports.Breadcrumb = Montage.create(Component, { | |||
29 | value: [] | 29 | value: [] |
30 | }, | 30 | }, |
31 | 31 | ||
32 | 32 | prepareForDraw: { | |
33 | deserializedFromTemplate : { | ||
34 | value: function() { | 33 | value: function() { |
35 | this.eventManager.addEventListener( "appLoaded", this, false); | 34 | this.breadcrumbBt.addEventListener("action", this, false); |
36 | this.eventManager.addEventListener( "breadCrumbTrail", this, false); | ||
37 | } | ||
38 | }, | ||
39 | |||
40 | handleAppLoaded : { | ||
41 | value: function() { | ||
42 | |||
43 | Object.defineBinding(this, "container", { | ||
44 | boundObject: this.application.ninja, | ||
45 | boundObjectPropertyPath: "currentSelectedContainer", | ||
46 | oneway: false | ||
47 | }); | ||
48 | |||
49 | } | 35 | } |
50 | }, | 36 | }, |
51 | 37 | ||
@@ -53,56 +39,38 @@ var Breadcrumb = exports.Breadcrumb = Montage.create(Component, { | |||
53 | value: function() { | 39 | value: function() { |
54 | var parentNode; | 40 | var parentNode; |
55 | 41 | ||
56 | this.containerElements.length = 0 | 42 | this.containerElements.length = 0; |
57 | 43 | ||
58 | if(this.container.id === "UserContent") { | 44 | parentNode = this.container; |
59 | this.containerElements.push({selected:false, element:this.container}); | ||
60 | } else { | ||
61 | parentNode = this.container; | ||
62 | 45 | ||
63 | while(parentNode.id!=="UserContent") { | 46 | while(parentNode.id !== "UserContent") { |
64 | this.containerElements.unshift({selected:false,element:parentNode}); | 47 | this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName}); |
65 | parentNode = parentNode.parentNode; | 48 | parentNode = parentNode.parentNode; |
66 | } | ||
67 | |||
68 | this.containerElements.unshift({selected:false,element:parentNode}); | ||
69 | } | 49 | } |
70 | 50 | ||
71 | NJevent('layerBinding',{selected:false ,element:this.container}) | 51 | // This is always the top container which is now hardcoded to body |
52 | this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": "Body"}); | ||
53 | |||
54 | // This is for the timeline -- Disable it since the timeline should not know about this object | ||
55 | // NJevent('layerBinding',{selected:false ,element:this.container}) | ||
56 | |||
72 | } | 57 | } |
73 | }, | 58 | }, |
74 | 59 | ||
75 | handleBreadCrumbTrail: { | 60 | handleAction: { |
76 | value: function(event) { | 61 | value: function(evt) { |
77 | var newLength,revaluatedLength,tmpvalue; | ||
78 | var i=0; | ||
79 | 62 | ||
80 | if(event.detail.setFlag ){ | 63 | if(evt.target.value === this.container.uuid) { |
81 | this.application.ninja.currentSelectedContainer = event.detail.element; | ||
82 | return; | 64 | return; |
83 | } | 65 | } |
84 | 66 | ||
85 | newLength = this.containerElements.length; | 67 | for(var i = this.containerElements.length - 1; i >= 0; i--) { |
68 | if(evt.target.value === this.containerElements[i].nodeUuid) break; | ||
86 | 69 | ||
87 | while(i < newLength ){ | 70 | this.containerElements.pop(); |
88 | if(this.containerElements[i].selected){ | ||
89 | tmpvalue = i; | ||
90 | break; | ||
91 | } | ||
92 | i++; | ||
93 | } | 71 | } |
94 | 72 | ||
95 | for(i = newLength -1 ; i >= 1 ; i--) { | 73 | this.application.ninja.currentSelectedContainer = this.containerElements[i].node; |
96 | if(tmpvalue !== i) { | ||
97 | this.containerElements.pop(); | ||
98 | } else { | ||
99 | break; | ||
100 | } | ||
101 | } | ||
102 | |||
103 | revaluatedLength = this.containerElements.length; | ||
104 | this.application.ninja.currentSelectedContainer = this.containerElements[revaluatedLength-1].element; | ||
105 | |||
106 | } | 74 | } |
107 | } | 75 | } |
108 | }); | 76 | }); |