aboutsummaryrefslogtreecommitdiff
path: root/js/document/document-text.js
diff options
context:
space:
mode:
authorAnanya Sen2012-05-18 16:56:16 -0700
committerAnanya Sen2012-05-18 16:56:16 -0700
commit7a22f7b368ef549a5b30c58a0f3900685b764bdb (patch)
tree44951af31368a5b287057e5cdddf0469cdc30298 /js/document/document-text.js
parent65cea92d839bcd25ea9094a0798190a4dc4bea35 (diff)
downloadninja-7a22f7b368ef549a5b30c58a0f3900685b764bdb.tar.gz
integrated open code view document in new dom architecture
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/document/document-text.js')
-rwxr-xr-xjs/document/document-text.js43
1 files changed, 40 insertions, 3 deletions
diff --git a/js/document/document-text.js b/js/document/document-text.js
index 2a469144..533b32c9 100755
--- a/js/document/document-text.js
+++ b/js/document/document-text.js
@@ -7,7 +7,9 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
7//////////////////////////////////////////////////////////////////////// 7////////////////////////////////////////////////////////////////////////
8// 8//
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 TextDocumentModel = require("js/document/models/text").TextDocumentModel,
12 CodeDocumentView = require("js/document/views/code").CodeDocumentView;
11//////////////////////////////////////////////////////////////////////// 13////////////////////////////////////////////////////////////////////////
12// 14//
13exports.TextDocument = Montage.create(Component, { 15exports.TextDocument = Montage.create(Component, {
@@ -16,9 +18,44 @@ exports.TextDocument = Montage.create(Component, {
16 hasTemplate: { 18 hasTemplate: {
17 enumerable: false, 19 enumerable: false,
18 value: false 20 value: false
19 } 21 },
20 ////////////////////////////////////////////////////////////////////
21 //////////////////////////////////////////////////////////////////// 22 ////////////////////////////////////////////////////////////////////
23 //
24 model: {
25 value: null
26 },
27 ////////////////////////////////////////////////////////////////////
28 //
29
30 init:{
31 enumerable: false,
32 value : function(file, context, callback, view){
33 var codeDocumentView = CodeDocumentView.create(), container = null;
34 codeDocumentView.initialize();
35
36 //Creating instance of Text Document Model
37 this.model = Montage.create(TextDocumentModel,{
38 file: {value: file},
39 parentContainer: {value: document.getElementById("codeViewContainer")},
40 views: {value: {'code': codeDocumentView, 'design': null}}
41 });
42
43 codeDocumentView.textArea.value = file.content;
44 codeDocumentView.initializeTextView(file, this);
45
46 if (view === 'code') {
47 //TODO: Remove reference and use as part of model
48 this.currentView = 'code';
49 //Setting current view object to design
50 this.model.currentView = this.model.views.code;
51 }
52
53
54 callback.call(context, this);
55 }
56 }
57////////////////////////////////////////////////////////////////////
58////////////////////////////////////////////////////////////////////
22}); 59});
23//////////////////////////////////////////////////////////////////////// 60////////////////////////////////////////////////////////////////////////
24//////////////////////////////////////////////////////////////////////// \ No newline at end of file 61//////////////////////////////////////////////////////////////////////// \ No newline at end of file