aboutsummaryrefslogtreecommitdiff
path: root/js/components/layout
diff options
context:
space:
mode:
Diffstat (limited to 'js/components/layout')
-rwxr-xr-xjs/components/layout/bread-crumb-button.reel/bread-crumb-button.js35
-rwxr-xr-xjs/components/layout/bread-crumb.reel/bread-crumb.js112
2 files changed, 44 insertions, 103 deletions
diff --git a/js/components/layout/bread-crumb-button.reel/bread-crumb-button.js b/js/components/layout/bread-crumb-button.reel/bread-crumb-button.js
index 65e5b7c8..3f5b87e1 100755
--- a/js/components/layout/bread-crumb-button.reel/bread-crumb-button.js
+++ b/js/components/layout/bread-crumb-button.reel/bread-crumb-button.js
@@ -7,45 +7,38 @@
7var Montage = require("montage/core/core").Montage; 7var Montage = require("montage/core/core").Montage;
8var Component = require("montage/ui/component").Component; 8var Component = require("montage/ui/component").Component;
9 9
10
11exports.BreadcrumbButton = Montage.create(Component, { 10exports.BreadcrumbButton = Montage.create(Component, {
12 11
13 button: { value: null }, 12 button: {
13 value: null
14 },
14 15
15 data: { value: null }, 16 data: {
17 value: null
18 },
16 19
17 prepareForDraw: { 20 prepareForDraw: {
18 enumerable: false,
19 value: function() { 21 value: function() {
20 this.element.addEventListener("mousedown", this, false); 22 this.element.addEventListener("mousedown", this, false);
21 } 23 }
22 }, 24 },
23 25
24 draw: { 26 draw: {
25 enumerable: false,
26 value: function() { 27 value: function() {
27 28 if(this.data.element.id === "UserContent") {
28 if(this.data.element.id==="UserContent"){ 29 this.button.innerHTML = "Body";
29 30 } else {
30 this.button.innerHTML = "Body"; 31 this.button.innerHTML = this.data.element.nodeName;
31 } 32 }
32
33 else{
34 this.button.innerHTML=this.data.element.nodeName;
35 }
36
37 } 33 }
38 }, 34 },
39 35
40 handleMousedown: { 36 handleMousedown: {
41 value: function(event) { 37 value: function(event) {
42 38
43 if(event.which===1){ 39 //this.data.selected=true;
44 40 NJevent('breadCrumbTrail',this.data);
45 this.data.selected=true; 41 //this.data.selected=false;
46 NJevent('breadCrumbTrail',this.data);
47 this.data.selected=false;
48 }
49 42
50 } 43 }
51 } 44 }
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;