aboutsummaryrefslogtreecommitdiff
path: root/js/stage
diff options
context:
space:
mode:
authorAnanya Sen2012-02-05 19:20:37 -0800
committerAnanya Sen2012-02-05 19:20:37 -0800
commit272c5f74f4ce76fec9cbe360817bf23639307d3a (patch)
tree1ae8ff6bbf6f22fbcca1e1a70f3063855d00ee46 /js/stage
parent45cfffd9261ab1aa714554c584f0d0d8fe627c91 (diff)
downloadninja-272c5f74f4ce76fec9cbe360817bf23639307d3a.tar.gz
changes to show document dirty indicator on editing code view, and to remove dirty indicator on save.
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/stage')
-rwxr-xr-xjs/stage/stage-view.reel/stage-view.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js
index cf7748fc..6f20b87b 100755
--- a/js/stage/stage-view.reel/stage-view.js
+++ b/js/stage/stage-view.reel/stage-view.js
@@ -95,9 +95,12 @@ exports.StageView = Montage.create(Component, {
95 //fix hack 95 //fix hack
96 document.getElementById("codeMirror_"+doc.uuid).style.display="block"; 96 document.getElementById("codeMirror_"+doc.uuid).style.display="block";
97 97
98 var documentController = this.application.ninja.documentController;
99
98 doc.editor = CodeMirror.fromTextArea(doc.textArea, { 100 doc.editor = CodeMirror.fromTextArea(doc.textArea, {
99 lineNumbers: true, 101 lineNumbers: true,
100 mode: type, 102 mode: type,
103 onChange: function(){doc.dirtyFlag=true;},
101 onCursorActivity: function() { 104 onCursorActivity: function() {
102 //documentController._codeEditor.editor.setLineClass(documentController._codeEditor.hline, null); 105 //documentController._codeEditor.editor.setLineClass(documentController._codeEditor.hline, null);
103 //documentController._codeEditor.hline = documentController._codeEditor.editor.setLineClass(documentController._codeEditor.editor.getCursor().line, "activeline"); 106 //documentController._codeEditor.hline = documentController._codeEditor.editor.setLineClass(documentController._codeEditor.editor.getCursor().line, "activeline");
@@ -128,6 +131,8 @@ exports.StageView = Montage.create(Component, {
128 this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe 131 this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe
129 this.application.ninja.documentController._showCurrentDocument(); 132 this.application.ninja.documentController._showCurrentDocument();
130 133
134 var documentController = this.application.ninja.documentController;
135
131 if(this.application.ninja.documentController.activeDocument.currentView === "code"){ 136 if(this.application.ninja.documentController.activeDocument.currentView === "code"){
132 var type; 137 var type;
133 switch(doc.documentType) { 138 switch(doc.documentType) {
@@ -143,6 +148,7 @@ exports.StageView = Montage.create(Component, {
143 doc.editor = CodeMirror.fromTextArea(doc.textArea, { 148 doc.editor = CodeMirror.fromTextArea(doc.textArea, {
144 lineNumbers: true, 149 lineNumbers: true,
145 mode: type, 150 mode: type,
151 onChange: function(){doc.dirtyFlag=true;},
146 onCursorActivity: function() { 152 onCursorActivity: function() {
147 //documentController._codeEditor.editor.setLineClass(documentController._codeEditor.hline, null); 153 //documentController._codeEditor.editor.setLineClass(documentController._codeEditor.hline, null);
148 //documentController._codeEditor.hline = documentController._codeEditor.editor.setLineClass(documentController._codeEditor.editor.getCursor().line, "activeline"); 154 //documentController._codeEditor.hline = documentController._codeEditor.editor.setLineClass(documentController._codeEditor.editor.getCursor().line, "activeline");
@@ -152,8 +158,15 @@ exports.StageView = Montage.create(Component, {
152 //this.application.ninja.documentController._codeEditor.hline = this.application.ninja.documentController._codeEditor.editor.setLineClass(0, "activeline"); 158 //this.application.ninja.documentController._codeEditor.hline = this.application.ninja.documentController._codeEditor.editor.setLineClass(0, "activeline");
153 } 159 }
154 160
161 if(this.application.ninja.documentController.activeDocument.documentType === "htm" || this.application.ninja.documentController.activeDocument.documentType === "html") {
162 this.application.ninja.stage._scrollFlag = true; // TODO HACK to prevent type error on Hide/Show Iframe
163 // TODO dispatch event here
164 // appDelegateModule.MyAppDelegate.onSetActiveDocument();
165 }
166
155 } 167 }
156 }, 168 },
169
157 refreshCodeDocument:{ 170 refreshCodeDocument:{
158 value:function(doc){ 171 value:function(doc){
159 172
@@ -198,5 +211,17 @@ exports.StageView = Montage.create(Component, {
198 } 211 }
199 }, this); 212 }, this);
200 } 213 }
214 },
215 showRulers:{
216 value:function(){
217 this.application.ninja.rulerTop.style.display = "block";
218 this.application.ninja.rulerLeft.style.display = "block";
219 }
220 },
221 hideRulers:{
222 value:function(){
223 this.application.ninja.rulerTop.style.display = "none";
224 this.application.ninja.rulerLeft.style.display = "none";
225 }
201 } 226 }
202}); \ No newline at end of file 227}); \ No newline at end of file