aboutsummaryrefslogtreecommitdiff
path: root/js/components/layout/document-entry.reel/document-entry.js
diff options
context:
space:
mode:
authorAnanya Sen2012-06-04 10:43:29 -0700
committerAnanya Sen2012-06-04 10:43:29 -0700
commit6fb29883329c9c42a8b406128b92c0e6323a47be (patch)
tree07f46e88bccf9cdb7d4e6818e1b646b0d19f05b9 /js/components/layout/document-entry.reel/document-entry.js
parentcf097ec69e35c07ecae5a105ed5eeb78291c9ac2 (diff)
parentc1ec69879028220b0c3f11ad6e24035bf527802c (diff)
downloadninja-6fb29883329c9c42a8b406128b92c0e6323a47be.tar.gz
Merge branch 'refs/heads/ninja-internal-master' into cut-copy-paste
Conflicts: js/ninja.reel/ninja.html Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/components/layout/document-entry.reel/document-entry.js')
-rwxr-xr-xjs/components/layout/document-entry.reel/document-entry.js58
1 files changed, 6 insertions, 52 deletions
diff --git a/js/components/layout/document-entry.reel/document-entry.js b/js/components/layout/document-entry.reel/document-entry.js
index 50b3624c..94056007 100755
--- a/js/components/layout/document-entry.reel/document-entry.js
+++ b/js/components/layout/document-entry.reel/document-entry.js
@@ -9,15 +9,7 @@ var Component = require("montage/ui/component").Component;
9 9
10exports.DocumentEntry = Montage.create(Component, { 10exports.DocumentEntry = Montage.create(Component, {
11 11
12 dirty: { value: null },
13
14 _uuid: {
15 value: null,
16 enumerable: false
17 },
18
19 _document: { 12 _document: {
20 enumerable: false,
21 value: null 13 value: null
22 }, 14 },
23 15
@@ -27,20 +19,17 @@ exports.DocumentEntry = Montage.create(Component, {
27 return this._document; 19 return this._document;
28 }, 20 },
29 set: function(value) { 21 set: function(value) {
30
31 if (this._document === value) { 22 if (this._document === value) {
32 return; 23 return;
33 } 24 }
34 25
35 this._document = value; 26 this._document = value;
36
37 if(value) {
38 this._uuid = value.uuid;
39 }
40 } 27 }
41 }, 28 },
42 29
43 _name: { value: null }, 30 _name: {
31 value: null
32 },
44 33
45 name: { 34 name: {
46 enumerable: false, 35 enumerable: false,
@@ -58,25 +47,6 @@ exports.DocumentEntry = Montage.create(Component, {
58 } 47 }
59 }, 48 },
60 49
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: { 50 _saveFlag: {
81 value: false 51 value: false
82 }, 52 },
@@ -93,21 +63,11 @@ exports.DocumentEntry = Montage.create(Component, {
93 } 63 }
94 }, 64 },
95 65
96 prepareForDraw: {
97 enumerable: false,
98 value: function() {
99 this.element.addEventListener("click", this, false);
100 }
101 },
102
103
104 draw: { 66 draw: {
105 enumerable: false, 67 enumerable: false,
106 value: function() { 68 value: function() {
107 this.label.innerText = this._name ? this._name : ""; 69 this.label.innerText = this._name ? this._name : "";
108 70
109 this._active ? this.element.classList.add("activeTab") : this.element.classList.remove("activeTab");
110
111 if(this.saveFlag) { 71 if(this.saveFlag) {
112 this.label.classList.add("dirty"); 72 this.label.classList.add("dirty");
113 } else { 73 } else {
@@ -116,15 +76,9 @@ exports.DocumentEntry = Montage.create(Component, {
116 } 76 }
117 }, 77 },
118 78
119 handleClick: { 79 handleCloseButtonAction: {
120 value: function(event) { 80 value: function() {
121 if(event._event.target.nodeName === "IMG") { 81 this.application.ninja.documentController.closeFile(this.document);
122 this.application.ninja.documentController.closeFile(this.application.ninja.documentController._findDocumentByUUID(this._uuid));
123 } else {
124 if(!this.active) {
125 this.application.ninja.documentController.switchDocuments(this.application.ninja.currentDocument, this.application.ninja.documentController._findDocumentByUUID(this._uuid));
126 }
127 }
128 } 82 }
129 } 83 }
130 84