aboutsummaryrefslogtreecommitdiff
path: root/js/controllers
diff options
context:
space:
mode:
authorAnanya Sen2012-02-15 09:51:12 -0800
committerAnanya Sen2012-02-15 09:51:12 -0800
commit9048cd50bf5e0a418d1d95498bb593961f72db36 (patch)
tree90d029bebddfcd4a8aa4ad6bb9730200b4b3f823 /js/controllers
parent2e308be9bec5e06d81b2905b65005a232f0a190d (diff)
downloadninja-9048cd50bf5e0a418d1d95498bb593961f72db36.tar.gz
Revert "Reverting text/html document classes and setting up MVC folder structure"
This reverts commit 68ce64a5a2f4a71b54d33916aaf1d57161302425. Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/controllers')
-rwxr-xr-xjs/controllers/document-controller.js25
1 files changed, 20 insertions, 5 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index f397ace7..25f60cc5 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -9,8 +9,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
9var Montage = require("montage/core/core").Montage, 9var Montage = require("montage/core/core").Montage,
10 Component = require("montage/ui/component").Component, 10 Component = require("montage/ui/component").Component,
11 Uuid = require("montage/core/uuid").Uuid, 11 Uuid = require("montage/core/uuid").Uuid,
12 HTMLDocument = require("js/document/html-document").HTMLDocument, 12 HTMLDocument = require("js/document/models/html-document").HTMLDocument,
13 TextDocument = require("js/document/text-document").TextDocument, 13 BaseDocument = require("js/document/models/base-document").BaseDocument,
14 DocumentController; 14 DocumentController;
15//////////////////////////////////////////////////////////////////////// 15////////////////////////////////////////////////////////////////////////
16// 16//
@@ -28,7 +28,13 @@ DocumentController = exports.DocumentController = Montage.create(Component, {
28 _iframeHolder: { value: null, enumerable: false }, 28 _iframeHolder: { value: null, enumerable: false },
29 _textHolder: { value: null, enumerable: false }, 29 _textHolder: { value: null, enumerable: false },
30 _codeMirrorCounter: {value: 1, enumerable: false}, 30 _codeMirrorCounter: {value: 1, enumerable: false},
31 31
32 tmpSourceForTesting: {
33 value: "function CodeMirror(place, givenOptions) {" +
34 "// Determine effective options based on given values and defaults." +
35 "var options = {}, defaults = CodeMirror.defaults; }"
36 },
37
32 activeDocument: { 38 activeDocument: {
33 get: function() { 39 get: function() {
34 return this._activeDocument; 40 return this._activeDocument;
@@ -56,12 +62,21 @@ DocumentController = exports.DocumentController = Montage.create(Component, {
56 this.eventManager.addEventListener("executeSave", this, false); 62 this.eventManager.addEventListener("executeSave", this, false);
57 63
58 this.eventManager.addEventListener("recordStyleChanged", this, false); 64 this.eventManager.addEventListener("recordStyleChanged", this, false);
65
66 // Temporary testing opening a new file after Ninja has loaded
67 this.eventManager.addEventListener("executeNewProject", this, false);
59 } 68 }
60 }, 69 },
61 70
62 handleAppLoaded: { 71 handleAppLoaded: {
63 value: function() { 72 value: function() {
64 // 73 //this.openDocument({"type": "html"});
74 }
75 },
76
77 handleExecuteNewProject: {
78 value: function() {
79 this.openDocument({"type": "html"});
65 } 80 }
66 }, 81 },
67 82
@@ -188,7 +203,7 @@ DocumentController = exports.DocumentController = Montage.create(Component, {
188 break; 203 break;
189 default: 204 default:
190 //Open in code view 205 //Open in code view
191 var code = Montage.create(TextDocument, {"source": {value: doc.content}}), docuuid = Uuid.generate(), textArea; 206 var code = Montage.create(BaseDocument, {"source": {value: doc.content}}), docuuid = Uuid.generate(), textArea;
192 textArea = this.application.ninja.stage.stageView.createTextAreaElement(docuuid); 207 textArea = this.application.ninja.stage.stageView.createTextAreaElement(docuuid);
193 code.initialize(doc, docuuid, textArea, textArea.parentNode); 208 code.initialize(doc, docuuid, textArea, textArea.parentNode);
194 //code.init(doc.name, doc.uri, doc.extension, null, docuuid); 209 //code.init(doc.name, doc.uri, doc.extension, null, docuuid);