aboutsummaryrefslogtreecommitdiff
path: root/js/components/layout/document-entry.reel
diff options
context:
space:
mode:
authorValerio Virgillito2012-05-29 00:34:40 -0700
committerValerio Virgillito2012-05-29 00:34:40 -0700
commit4c3aac5eabd93052b1554a03d78235215bb49db4 (patch)
treefe08f4f6d33d81d602f56daeaec845577fb9d8a5 /js/components/layout/document-entry.reel
parent9a66ccad0235484643ef6d821315b11b5be4a93e (diff)
downloadninja-4c3aac5eabd93052b1554a03d78235215bb49db4.tar.gz
document bindings phase 1
- using array controller to bind the current document to all ninja components - removed open document event - removed references to the document controller Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/components/layout/document-entry.reel')
-rwxr-xr-xjs/components/layout/document-entry.reel/document-entry.css22
-rwxr-xr-xjs/components/layout/document-entry.reel/document-entry.html14
-rwxr-xr-xjs/components/layout/document-entry.reel/document-entry.js44
3 files changed, 41 insertions, 39 deletions
diff --git a/js/components/layout/document-entry.reel/document-entry.css b/js/components/layout/document-entry.reel/document-entry.css
index 4601974f..010e1da7 100755
--- a/js/components/layout/document-entry.reel/document-entry.css
+++ b/js/components/layout/document-entry.reel/document-entry.css
@@ -19,7 +19,20 @@
19 min-width:0px; 19 min-width:0px;
20} 20}
21 21
22.documentEntry img { 22.mybutton {
23 display: inline;
24 -webkit-appearance: none;
25 outline: none;
26
27 font-size: 9px;
28 cursor: pointer;
29 border: 0px;
30 background-color: #474747;
31 background-image: -webkit-linear-gradient(top, #505050 0%, #3c3c3c 100%);
32
33}
34
35.documentEntry button {
23 opacity: 0.5; /* 50% */ 36 opacity: 0.5; /* 50% */
24 width: 12px; 37 width: 12px;
25 max-width:12px; 38 max-width:12px;
@@ -29,17 +42,14 @@
29 transition: opacity 0.2s ease; 42 transition: opacity 0.2s ease;
30} 43}
31 44
32.documentEntry:hover, 45.documentEntry.selected {
33.documentEntry:active, 46 background-color:#7F7F7F;
34.documentEntry.activeTab {
35 /*background-color: #7f7f7f; *//* rgb(127, 127, 127); */
36} 47}
37 48
38.documentEntry img:hover { 49.documentEntry img:hover {
39 opacity: 1.0; /* 100% */ 50 opacity: 1.0; /* 100% */
40} 51}
41 52
42
43.documentEntry span.dirty:before{ 53.documentEntry span.dirty:before{
44 content: "*"; 54 content: "*";
45 display:inline; 55 display:inline;
diff --git a/js/components/layout/document-entry.reel/document-entry.html b/js/components/layout/document-entry.reel/document-entry.html
index 679ebb62..bd8c25cb 100755
--- a/js/components/layout/document-entry.reel/document-entry.html
+++ b/js/components/layout/document-entry.reel/document-entry.html
@@ -15,8 +15,14 @@
15 "prototype": "js/components/layout/document-entry.reel", 15 "prototype": "js/components/layout/document-entry.reel",
16 "properties": { 16 "properties": {
17 "element": {"#": "documentEntry"}, 17 "element": {"#": "documentEntry"},
18 "label": {"#": "name"}, 18 "label": {"#": "name"}
19 "activeBack": {"#": "isActive"} 19 }
20 },
21
22 "closeButton": {
23 "prototype": "montage/ui/button.reel",
24 "properties": {
25 "element": {"#": "close-btn"}
20 } 26 }
21 } 27 }
22 } 28 }
@@ -24,9 +30,9 @@
24 </head> 30 </head>
25 <body> 31 <body>
26 <li data-montage-id="documentEntry" class="documentEntry"> 32 <li data-montage-id="documentEntry" class="documentEntry">
27 <div data-montage-id="isActive"></div>
28 <span data-montage-id="name"></span> 33 <span data-montage-id="name"></span>
29 <img src="js/components/layout/document-entry.reel/close_button.gif"> 34 <!--<img src="js/components/layout/document-entry.reel/close_button.gif" data-montage-id="close-btn">-->
35 <button type="button" class="mybutton" data-montage-id="close-btn"></button>
30 </li> 36 </li>
31 </body> 37 </body>
32</html> \ No newline at end of file 38</html> \ No newline at end of file
diff --git a/js/components/layout/document-entry.reel/document-entry.js b/js/components/layout/document-entry.reel/document-entry.js
index 50b3624c..2e66c7cd 100755
--- a/js/components/layout/document-entry.reel/document-entry.js
+++ b/js/components/layout/document-entry.reel/document-entry.js
@@ -58,25 +58,6 @@ exports.DocumentEntry = Montage.create(Component, {
58 } 58 }
59 }, 59 },
60 60
61 _active: {
62 enumerable: false,
63 value: null
64 },
65
66 active: {
67 get: function() {
68 return this._active;
69 },
70 set: function(value) {
71 var previousValue = this._active;
72 this._active = value;
73
74 if (previousValue !== this._active) {
75 this.needsDraw = true;
76 }
77 }
78 },
79
80 _saveFlag: { 61 _saveFlag: {
81 value: false 62 value: false
82 }, 63 },
@@ -96,7 +77,8 @@ exports.DocumentEntry = Montage.create(Component, {
96 prepareForDraw: { 77 prepareForDraw: {
97 enumerable: false, 78 enumerable: false,
98 value: function() { 79 value: function() {
99 this.element.addEventListener("click", this, false); 80// this.element.addEventListener("click", this, false);
81// this.closeBtn.addEventListener("click", this, true);
100 } 82 }
101 }, 83 },
102 84
@@ -106,7 +88,7 @@ exports.DocumentEntry = Montage.create(Component, {
106 value: function() { 88 value: function() {
107 this.label.innerText = this._name ? this._name : ""; 89 this.label.innerText = this._name ? this._name : "";
108 90
109 this._active ? this.element.classList.add("activeTab") : this.element.classList.remove("activeTab"); 91// this._active ? this.element.classList.add("activeTab") : this.element.classList.remove("activeTab");
110 92
111 if(this.saveFlag) { 93 if(this.saveFlag) {
112 this.label.classList.add("dirty"); 94 this.label.classList.add("dirty");
@@ -116,15 +98,19 @@ exports.DocumentEntry = Montage.create(Component, {
116 } 98 }
117 }, 99 },
118 100
119 handleClick: { 101 captureClick: {
120 value: function(event) { 102 value: function(event) {
121 if(event._event.target.nodeName === "IMG") { 103 console.log("clicked on the X");
122 this.application.ninja.documentController.closeFile(this.application.ninja.documentController._findDocumentByUUID(this._uuid)); 104 event.preventDefault();
123 } else { 105 event.stopImmediatePropagation();
124 if(!this.active) { 106 event.stopPropagation();
125 this.application.ninja.documentController.switchDocuments(this.application.ninja.currentDocument, this.application.ninja.documentController._findDocumentByUUID(this._uuid)); 107// if(event._event.target.nodeName === "IMG") {
126 } 108// this.application.ninja.documentController.closeFile(this.application.ninja.documentController._findDocumentByUUID(this._uuid));
127 } 109// } else {
110// if(!this.active) {
111// this.application.ninja.documentController.switchDocuments(this.application.ninja.currentDocument, this.application.ninja.documentController._findDocumentByUUID(this._uuid));
112// }
113// }
128 } 114 }
129 } 115 }
130 116