diff options
-rwxr-xr-x | js/components/layout/document-entry.reel/document-entry.html | 1 | ||||
-rwxr-xr-x | js/components/layout/document-entry.reel/document-entry.js | 24 | ||||
-rwxr-xr-x | js/components/layout/documents-tab.reel/documents-tab.html | 4 | ||||
-rwxr-xr-x | js/controllers/document-controller.js | 15 | ||||
-rwxr-xr-x | js/document/html-document.js | 9 | ||||
-rwxr-xr-x | js/document/text-document.js | 36 | ||||
-rwxr-xr-x | js/mediators/element-mediator.js | 4 | ||||
-rwxr-xr-x | js/stage/stage-view.reel/stage-view.js | 4 | ||||
-rwxr-xr-x | scss/imports/scss/_MainWindow.scss | 2 |
9 files changed, 32 insertions, 67 deletions
diff --git a/js/components/layout/document-entry.reel/document-entry.html b/js/components/layout/document-entry.reel/document-entry.html index ba17449a..1cf01737 100755 --- a/js/components/layout/document-entry.reel/document-entry.html +++ b/js/components/layout/document-entry.reel/document-entry.html | |||
@@ -26,7 +26,6 @@ | |||
26 | <body> | 26 | <body> |
27 | <li id="documentEntry" class="documentEntry"> | 27 | <li id="documentEntry" class="documentEntry"> |
28 | <div id="isActive"></div> | 28 | <div id="isActive"></div> |
29 | <div id="dirtyFlag"></div> | ||
30 | <span id="name"></span> | 29 | <span id="name"></span> |
31 | <img src="js/components/layout/document-entry.reel/close_button.gif"> | 30 | <img src="js/components/layout/document-entry.reel/close_button.gif"> |
32 | </li> | 31 | </li> |
diff --git a/js/components/layout/document-entry.reel/document-entry.js b/js/components/layout/document-entry.reel/document-entry.js index a1bed79b..9e4110e2 100755 --- a/js/components/layout/document-entry.reel/document-entry.js +++ b/js/components/layout/document-entry.reel/document-entry.js | |||
@@ -77,19 +77,17 @@ exports.DocumentEntry = Montage.create(Component, { | |||
77 | } | 77 | } |
78 | }, | 78 | }, |
79 | 79 | ||
80 | _dirtyFlag:{ | 80 | _saveFlag: { |
81 | enumerable:false, | 81 | value: false |
82 | value:false | ||
83 | }, | 82 | }, |
84 | dirtyFlag:{ | 83 | |
84 | saveFlag: { | ||
85 | get: function() { | 85 | get: function() { |
86 | return this._dirtyFlag; | 86 | return this._saveFlag; |
87 | }, | 87 | }, |
88 | set: function(value) { | 88 | set: function(value) { |
89 | var previousValue = this._dirtyFlag; | 89 | if(this._saveFlag !== value) { |
90 | this._dirtyFlag = value; | 90 | this._saveFlag = value; |
91 | |||
92 | if (previousValue !== this._dirtyFlag) { | ||
93 | this.needsDraw = true; | 91 | this.needsDraw = true; |
94 | } | 92 | } |
95 | } | 93 | } |
@@ -110,10 +108,10 @@ exports.DocumentEntry = Montage.create(Component, { | |||
110 | 108 | ||
111 | this._active ? this.element.classList.add("activeTab") : this.element.classList.remove("activeTab"); | 109 | this._active ? this.element.classList.add("activeTab") : this.element.classList.remove("activeTab"); |
112 | 110 | ||
113 | if(this.dirtyFlag === true){ | 111 | if(this.saveFlag) { |
114 | if(!this.label.classList.contains("dirty")){this.label.classList.add("dirty");} | 112 | this.label.classList.add("dirty"); |
115 | }else{ | 113 | } else { |
116 | if(this.label.classList.contains("dirty")){this.label.classList.remove("dirty");} | 114 | this.label.classList.remove("dirty"); |
117 | } | 115 | } |
118 | } | 116 | } |
119 | }, | 117 | }, |
diff --git a/js/components/layout/documents-tab.reel/documents-tab.html b/js/components/layout/documents-tab.reel/documents-tab.html index 82ba8782..737dfbcb 100755 --- a/js/components/layout/documents-tab.reel/documents-tab.html +++ b/js/components/layout/documents-tab.reel/documents-tab.html | |||
@@ -38,9 +38,9 @@ | |||
38 | "boundObjectPropertyPath": "objectAtCurrentIteration.name", | 38 | "boundObjectPropertyPath": "objectAtCurrentIteration.name", |
39 | "oneway": true | 39 | "oneway": true |
40 | }, | 40 | }, |
41 | "dirtyFlag": { | 41 | "saveFlag": { |
42 | "boundObject": {"@": "repetition1"}, | 42 | "boundObject": {"@": "repetition1"}, |
43 | "boundObjectPropertyPath": "objectAtCurrentIteration.dirtyFlag", | 43 | "boundObjectPropertyPath": "objectAtCurrentIteration.needsSave", |
44 | "oneway": true | 44 | "oneway": true |
45 | }, | 45 | }, |
46 | "active": { | 46 | "active": { |
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 9a063280..e0402219 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -131,20 +131,11 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
131 | fileSaveResult: { | 131 | fileSaveResult: { |
132 | value: function (result) { | 132 | value: function (result) { |
133 | if(result.status === 204){ | 133 | if(result.status === 204){ |
134 | this.clearDocumentDirtyFlag(); | 134 | this.activeDocument.needsSave = false; |
135 | } | 135 | } |
136 | } | 136 | } |
137 | }, | 137 | }, |
138 | //////////////////////////////////////////////////////////////////// | 138 | |
139 | |||
140 | |||
141 | clearDocumentDirtyFlag:{ | ||
142 | value: function(){ | ||
143 | this.activeDocument.dirtyFlag = false; | ||
144 | } | ||
145 | }, | ||
146 | |||
147 | |||
148 | createNewFile:{ | 139 | createNewFile:{ |
149 | value:function(newFileObj){ | 140 | value:function(newFileObj){ |
150 | //console.log(newFileObj);//contains the template uri and the new file uri | 141 | //console.log(newFileObj);//contains the template uri and the new file uri |
@@ -282,7 +273,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
282 | 273 | ||
283 | closeDocument: { | 274 | closeDocument: { |
284 | value: function(id) { | 275 | value: function(id) { |
285 | if(this.activeDocument.dirtyFlag === true){ | 276 | if(this.activeDocument.needsSave === true){ |
286 | //if file dirty then alert user to save | 277 | //if file dirty then alert user to save |
287 | } | 278 | } |
288 | 279 | ||
diff --git a/js/document/html-document.js b/js/document/html-document.js index 28818774..01d042d6 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js | |||
@@ -290,15 +290,6 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
290 | } | 290 | } |
291 | }, | 291 | }, |
292 | 292 | ||
293 | |||
294 | |||
295 | AppendElement: { | ||
296 | value: function(element, parent) { | ||
297 | this.dirtyFlag = true; | ||
298 | } | ||
299 | }, | ||
300 | |||
301 | |||
302 | /** | 293 | /** |
303 | * Return the specified inline attribute from the element. | 294 | * Return the specified inline attribute from the element. |
304 | */ | 295 | */ |
diff --git a/js/document/text-document.js b/js/document/text-document.js index 1132ba65..88464d87 100755 --- a/js/document/text-document.js +++ b/js/document/text-document.js | |||
@@ -120,15 +120,15 @@ var TextDocument = exports.TextDocument = Montage.create(Component, { | |||
120 | 120 | ||
121 | 121 | ||
122 | /** Private Members **/ | 122 | /** Private Members **/ |
123 | _name: { value: null, enumerable: false }, | 123 | _name: { value: null, enumerable: false }, |
124 | _uri: { value: null, enumerable: false }, | 124 | _uri: { value: null, enumerable: false }, |
125 | _documentType: { value: null, enumerable: false }, | 125 | _documentType: { value: null, enumerable: false }, |
126 | _container: {value: null, enumerable: false }, | 126 | _container: { value: null, enumerable: false }, |
127 | _uuid: { value: null, enumerable: false }, | 127 | _uuid: { value: null, enumerable: false }, |
128 | _isActive: { value: true, enumerable: false }, | 128 | _isActive: { value: true, enumerable: false }, |
129 | _dirtyFlag: { value: false, enumerable: false }, | 129 | _needsSave: { value: false, enumarable: false }, |
130 | _callback: { value: null, enumerable: false }, | 130 | _callback: { value: null, enumerable: false }, |
131 | _currentView: { value: null, enumerable: false}, | 131 | _currentView: { value: null, enumerable: false}, |
132 | 132 | ||
133 | /** Getters/Setters **/ | 133 | /** Getters/Setters **/ |
134 | name: { | 134 | name: { |
@@ -161,9 +161,9 @@ var TextDocument = exports.TextDocument = Montage.create(Component, { | |||
161 | set: function(value) { this._isActive = value; } | 161 | set: function(value) { this._isActive = value; } |
162 | }, | 162 | }, |
163 | 163 | ||
164 | dirtyFlag: { | 164 | needsSave: { |
165 | get: function() { return this._dirtyFlag; }, | 165 | get: function() { return this._needsSave; }, |
166 | set: function(value) { this._dirtyFlag = value; } | 166 | set: function(value) { this._needsSave = value } |
167 | }, | 167 | }, |
168 | 168 | ||
169 | callback: { | 169 | callback: { |
@@ -192,17 +192,5 @@ var TextDocument = exports.TextDocument = Montage.create(Component, { | |||
192 | value: function() { | 192 | value: function() { |
193 | // Have the XHR here? | 193 | // Have the XHR here? |
194 | } | 194 | } |
195 | }, | ||
196 | |||
197 | markEdited:{ | ||
198 | value: function() { | ||
199 | this.dirtyFlag = true; | ||
200 | } | ||
201 | }, | ||
202 | |||
203 | markUnedited:{ | ||
204 | value: function() { | ||
205 | this.dirtyFlag = false; | ||
206 | } | ||
207 | } | 195 | } |
208 | }); \ No newline at end of file | 196 | }); \ No newline at end of file |
diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index 6088aeab..95a72c89 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js | |||
@@ -102,7 +102,7 @@ exports.ElementMediator = Montage.create(NJComponent, { | |||
102 | el.elementModel.controller["set3DProperties"](el, [p3d], 0, true); | 102 | el.elementModel.controller["set3DProperties"](el, [p3d], 0, true); |
103 | } | 103 | } |
104 | if(!noEvent) { | 104 | if(!noEvent) { |
105 | this.application.ninja.documentController.activeDocument.markEdited(); | 105 | this.application.ninja.documentController.activeDocument.needsSave = true; |
106 | NJevent("elementAdded", el); | 106 | NJevent("elementAdded", el); |
107 | } | 107 | } |
108 | } | 108 | } |
@@ -130,7 +130,7 @@ exports.ElementMediator = Montage.create(NJComponent, { | <