diff options
author | Eric Guzman | 2012-05-22 15:57:23 -0700 |
---|---|---|
committer | Eric Guzman | 2012-05-22 15:57:23 -0700 |
commit | ad3b4595d7377e5bf75bcb8ad81007859b0a8a02 (patch) | |
tree | ecb7fe289824a625b1dc422a97c2236826081ec3 /js/document/document-text.js | |
parent | 0eb95ff2dbba1fe7213eed2e0140b4d07bda3dd5 (diff) | |
parent | 2b207ef8b2594927f8cd6cd63a8483d205cb86c4 (diff) | |
download | ninja-ad3b4595d7377e5bf75bcb8ad81007859b0a8a02.tar.gz |
Merge branch 'dom-architecture' of github.com:Motorola-Mobility/ninja-internal into CSSPanelUpdates
Conflicts:
js/controllers/styles-controller.js
Diffstat (limited to 'js/document/document-text.js')
-rwxr-xr-x | js/document/document-text.js | 52 |
1 files changed, 49 insertions, 3 deletions
diff --git a/js/document/document-text.js b/js/document/document-text.js index 2a469144..bb63f5f8 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 | // |
9 | var Montage = require("montage/core/core").Montage, | 9 | var 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 | // |
13 | exports.TextDocument = Montage.create(Component, { | 15 | exports.TextDocument = Montage.create(Component, { |
@@ -16,9 +18,53 @@ 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 | |||
35 | //Creating instance of Text Document Model | ||
36 | this.model = Montage.create(TextDocumentModel,{ | ||
37 | file: {value: file}, | ||
38 | parentContainer: {value: document.getElementById("codeViewContainer")}, | ||
39 | views: {value: {'code': codeDocumentView, 'design': null}} | ||
40 | }); | ||
41 | |||
42 | codeDocumentView.initialize(this.model.parentContainer); | ||
43 | |||
44 | codeDocumentView.textArea.value = file.content; | ||
45 | codeDocumentView.initializeTextView(file, this); | ||
46 | |||
47 | if (view === 'code') { | ||
48 | //TODO: Remove reference and use as part of model | ||
49 | this.currentView = 'code'; | ||
50 | //Setting current view object to design | ||
51 | this.model.currentView = this.model.views.code; | ||
52 | } | ||
53 | |||
54 | |||
55 | callback.call(context, this); | ||
56 | } | ||
57 | }, | ||
58 | //////////////////////////////////////////////////////////////////// | ||
59 | // | ||
60 | closeDocument: { | ||
61 | value: function (context, callback) { | ||
62 | var closed = this.model.close(null); | ||
63 | |||
64 | callback.call(context, this); | ||
65 | } | ||
66 | } | ||
67 | //////////////////////////////////////////////////////////////////// | ||
22 | }); | 68 | }); |
23 | //////////////////////////////////////////////////////////////////////// | 69 | //////////////////////////////////////////////////////////////////////// |
24 | //////////////////////////////////////////////////////////////////////// \ No newline at end of file | 70 | //////////////////////////////////////////////////////////////////////// \ No newline at end of file |