diff options
author | Valerio Virgillito | 2012-05-28 21:14:39 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-05-28 21:14:39 -0700 |
commit | 58e454c828abf0b64fa62120359bcd78a0d34ac4 (patch) | |
tree | 612f89237836d349268df15eee3f0973c994daca /js/document/views | |
parent | 9a66ccad0235484643ef6d821315b11b5be4a93e (diff) | |
parent | 32166f2753f24ff84b33a5ec925437577d53f197 (diff) | |
download | ninja-58e454c828abf0b64fa62120359bcd78a0d34ac4.tar.gz |
Merge pull request #257 from joseeight/Document
Cleaning and tidying up.
Diffstat (limited to 'js/document/views')
-rwxr-xr-x | js/document/views/code.js | 56 | ||||
-rwxr-xr-x | js/document/views/design.js | 6 |
2 files changed, 24 insertions, 38 deletions
diff --git a/js/document/views/code.js b/js/document/views/code.js index 66d1c702..0a0ff5c1 100755 --- a/js/document/views/code.js +++ b/js/document/views/code.js | |||
@@ -10,15 +10,13 @@ var Montage = require("montage/core/core").Montage, | |||
10 | Component = require("montage/ui/component").Component, | 10 | Component = require("montage/ui/component").Component, |
11 | BaseDocumentView = require("js/document/views/base").BaseDocumentView; | 11 | BaseDocumentView = require("js/document/views/base").BaseDocumentView; |
12 | //////////////////////////////////////////////////////////////////////// | 12 | //////////////////////////////////////////////////////////////////////// |
13 | // | 13 | // |
14 | var CodeDocumentView = exports.CodeDocumentView = Montage.create(BaseDocumentView, { | 14 | exports.CodeDocumentView = Montage.create(BaseDocumentView, { |
15 | //////////////////////////////////////////////////////////////////// | 15 | //////////////////////////////////////////////////////////////////// |
16 | // | 16 | // |
17 | hasTemplate: { | 17 | hasTemplate: { |
18 | enumerable: false, | ||
19 | value: false | 18 | value: false |
20 | }, | 19 | }, |
21 | |||
22 | //////////////////////////////////////////////////////////////////// | 20 | //////////////////////////////////////////////////////////////////// |
23 | // | 21 | // |
24 | _editor: { | 22 | _editor: { |
@@ -28,7 +26,7 @@ var CodeDocumentView = exports.CodeDocumentView = Montage.create(BaseDocumentVie | |||
28 | // | 26 | // |
29 | editor: { | 27 | editor: { |
30 | get: function() {return this._editor;}, | 28 | get: function() {return this._editor;}, |
31 | set: function(value) {this._editor= value;} | 29 | set: function(value) {this._editor = value;} |
32 | }, | 30 | }, |
33 | //////////////////////////////////////////////////////////////////// | 31 | //////////////////////////////////////////////////////////////////// |
34 | // | 32 | // |
@@ -39,7 +37,7 @@ var CodeDocumentView = exports.CodeDocumentView = Montage.create(BaseDocumentVie | |||
39 | // | 37 | // |
40 | textArea: { | 38 | textArea: { |
41 | get: function() {return this._textArea;}, | 39 | get: function() {return this._textArea;}, |
42 | set: function(value) {this._textArea= value;} | 40 | set: function(value) {this._textArea = value;} |
43 | }, | 41 | }, |
44 | //////////////////////////////////////////////////////////////////// | 42 | //////////////////////////////////////////////////////////////////// |
45 | // | 43 | // |
@@ -50,14 +48,10 @@ var CodeDocumentView = exports.CodeDocumentView = Montage.create(BaseDocumentVie | |||
50 | // | 48 | // |
51 | textViewContainer: { | 49 | textViewContainer: { |
52 | get: function() {return this._textViewContainer;}, | 50 | get: function() {return this._textViewContainer;}, |
53 | set: function(value) {this._textViewContainer= value;} | 51 | set: function(value) {this._textViewContainer = value;} |
54 | }, | 52 | }, |
55 | //////////////////////////////////////////////////////////////////// | 53 | //////////////////////////////////////////////////////////////////// |
56 | // | 54 | // |
57 | |||
58 | /** | ||
59 | * Public method | ||
60 | */ | ||
61 | initialize:{ | 55 | initialize:{ |
62 | value: function(parentContainer){ | 56 | value: function(parentContainer){ |
63 | //create contianer | 57 | //create contianer |
@@ -65,42 +59,35 @@ var CodeDocumentView = exports.CodeDocumentView = Montage.create(BaseDocumentVie | |||
65 | //this.textViewContainer.id = "codemirror_" + uuid; | 59 | //this.textViewContainer.id = "codemirror_" + uuid; |
66 | this.textViewContainer.style.display = "block"; | 60 | this.textViewContainer.style.display = "block"; |
67 | parentContainer.appendChild(this.textViewContainer); | 61 | parentContainer.appendChild(this.textViewContainer); |
68 | |||
69 | //create text area | 62 | //create text area |
70 | this.textArea = this.createTextAreaElement(); | 63 | this.textArea = this.createTextAreaElement(); |
71 | } | 64 | } |
72 | }, | 65 | }, |
73 | 66 | //////////////////////////////////////////////////////////////////// | |
74 | /** | 67 | //Creates a textarea element which will contain the content of the opened text document |
75 | * Public method | ||
76 | * Creates a textarea element which will contain the content of the opened text document. | ||
77 | */ | ||
78 | createTextAreaElement: { | 68 | createTextAreaElement: { |
79 | value: function() { | 69 | value: function() { |
80 | var textArea = document.createElement("textarea"); | 70 | var textArea = document.createElement("textarea"); |
81 | // textArea.id = "code"; | 71 | //textArea.id = "code"; |
82 | // textArea.name = "code"; | 72 | //textArea.name = "code"; |
83 | this.textViewContainer.appendChild(textArea); | 73 | this.textViewContainer.appendChild(textArea); |
84 | 74 | //Returns textarea element | |
85 | return textArea; | 75 | return textArea; |
86 | } | 76 | } |
87 | }, | 77 | }, |
88 | //////////////////////////////////////////////////////////////////// | 78 | //////////////////////////////////////////////////////////////////// |
89 | // | 79 | //Creates a new instance of a code editor |
90 | /** | ||
91 | * Public method | ||
92 | * Creates a new instance of a code editor | ||
93 | */ | ||
94 | initializeTextView: { | 80 | initializeTextView: { |
95 | value: function(file, textDocument) { | 81 | value: function(file, textDocument) { |
82 | // | ||
96 | var type; | 83 | var type; |
97 | 84 | // | |
98 | if(this.activeDocument) { | 85 | if(this.activeDocument) { |
99 | //need to hide only if another document was open before | 86 | //need to hide only if another document was open before |
100 | // this.application.ninja.documentController._hideCurrentDocument(); | 87 | //this.application.ninja.documentController._hideCurrentDocument(); |
101 | // this.hideOtherDocuments(doc.uuid); | 88 | //this.hideOtherDocuments(doc.uuid); |
102 | } | 89 | } |
103 | 90 | // | |
104 | switch(file.extension) { | 91 | switch(file.extension) { |
105 | case "css" : | 92 | case "css" : |
106 | type = "css"; | 93 | type = "css"; |
@@ -130,18 +117,18 @@ var CodeDocumentView = exports.CodeDocumentView = Montage.create(BaseDocumentVie | |||
130 | type = "xml"; | 117 | type = "xml"; |
131 | break; | 118 | break; |
132 | } | 119 | } |
120 | // | ||
133 | this.textViewContainer.style.display="block"; | 121 | this.textViewContainer.style.display="block"; |
134 | 122 | // | |
135 | this.editor = this.application.ninja.codeEditorController.createEditor(this, type, file.extension, textDocument); | 123 | this.editor = this.application.ninja.codeEditorController.createEditor(this, type, file.extension, textDocument); |
136 | this.editor.hline = this.editor.setLineClass(0, "activeline"); | 124 | this.editor.hline = this.editor.setLineClass(0, "activeline"); |
137 | |||
138 | |||
139 | } | 125 | } |
140 | }, | 126 | }, |
141 | //////////////////////////////////////////////////////////////////// | 127 | //////////////////////////////////////////////////////////////////// |
142 | // | 128 | // |
143 | show: { | 129 | show: { |
144 | value: function (callback) { | 130 | value: function (callback) { |
131 | // | ||
145 | this.textViewContainer.style.display = "block"; | 132 | this.textViewContainer.style.display = "block"; |
146 | // | 133 | // |
147 | if (callback) callback(); | 134 | if (callback) callback(); |
@@ -151,6 +138,7 @@ var CodeDocumentView = exports.CodeDocumentView = Montage.create(BaseDocumentVie | |||
151 | // | 138 | // |
152 | hide: { | 139 | hide: { |
153 | value: function (callback) { | 140 | value: function (callback) { |
141 | // | ||
154 | this.textViewContainer.style.display = "none"; | 142 | this.textViewContainer.style.display = "none"; |
155 | // | 143 | // |
156 | if (callback) callback(); | 144 | if (callback) callback(); |
@@ -164,8 +152,8 @@ var CodeDocumentView = exports.CodeDocumentView = Montage.create(BaseDocumentVie | |||
164 | this.textViewContainer.className = "codeViewContainer "+themeClass; | 152 | this.textViewContainer.className = "codeViewContainer "+themeClass; |
165 | } | 153 | } |
166 | } | 154 | } |
167 | //////////////////////////////////////////////////////////////////////// | 155 | //////////////////////////////////////////////////////////////////// |
168 | //////////////////////////////////////////////////////////////////////// | 156 | //////////////////////////////////////////////////////////////////// |
169 | }); | 157 | }); |
170 | //////////////////////////////////////////////////////////////////////// | 158 | //////////////////////////////////////////////////////////////////////// |
171 | //////////////////////////////////////////////////////////////////////// \ No newline at end of file | 159 | //////////////////////////////////////////////////////////////////////// \ No newline at end of file |
diff --git a/js/document/views/design.js b/js/document/views/design.js index d772aa86..c7313708 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js | |||
@@ -67,13 +67,13 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
67 | propertiesPanel: { | 67 | propertiesPanel: { |
68 | value: null | 68 | value: null |
69 | }, | 69 | }, |
70 | |||
71 | //////////////////////////////////////////////////////////////////// | 70 | //////////////////////////////////////////////////////////////////// |
72 | // | 71 | // |
73 | _liveNodeList: { | 72 | _liveNodeList: { |
74 | value: null | 73 | value: null |
75 | }, | 74 | }, |
76 | 75 | //////////////////////////////////////////////////////////////////// | |
76 | // | ||
77 | getLiveNodeList: { | 77 | getLiveNodeList: { |
78 | value: function(useFilter) { | 78 | value: function(useFilter) { |
79 | if(useFilter) { | 79 | if(useFilter) { |
@@ -93,8 +93,6 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { | |||
93 | }, | 93 | }, |
94 | //////////////////////////////////////////////////////////////////// | 94 | //////////////////////////////////////////////////////////////////// |
95 | // | 95 | // |
96 | |||
97 | // | ||
98 | initialize: { | 96 | initialize: { |
99 | value: function (parent) { | 97 | value: function (parent) { |
100 | //Creating iFrame for view | 98 | //Creating iFrame for view |