aboutsummaryrefslogtreecommitdiff
path: root/js/document/views
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-08-07 13:27:19 -0700
committerNivesh Rajbhandari2012-08-07 13:27:19 -0700
commitda71ec8bf450438a4dc904cb348e548d01dfcb3f (patch)
tree36bae4f77a61c2c6690566c79d07f5b6bc2c3936 /js/document/views
parent923e760bf4a16baa82e81da6d38e671620664e8f (diff)
parent91c440a04f0108d05e663d1696027ca5601b25bc (diff)
downloadninja-da71ec8bf450438a4dc904cb348e548d01dfcb3f.tar.gz
Merge branch 'refs/heads/ninja-mqg734-master' into LineInCanvas
Diffstat (limited to 'js/document/views')
-rwxr-xr-xjs/document/views/code.js4
-rw-r--r--js/document/views/design-code.js106
-rwxr-xr-xjs/document/views/design.js4
3 files changed, 110 insertions, 4 deletions
diff --git a/js/document/views/code.js b/js/document/views/code.js
index 05f671b2..0ca87fa9 100755
--- a/js/document/views/code.js
+++ b/js/document/views/code.js
@@ -39,8 +39,8 @@ var Montage = require("montage/core/core").Montage,
39exports.CodeDocumentView = Montage.create(BaseDocumentView, { 39exports.CodeDocumentView = Montage.create(BaseDocumentView, {
40 //////////////////////////////////////////////////////////////////// 40 ////////////////////////////////////////////////////////////////////
41 // 41 //
42 hasTemplate: { 42 identifier: {
43 value: false 43 value: "code"
44 }, 44 },
45 //////////////////////////////////////////////////////////////////// 45 ////////////////////////////////////////////////////////////////////
46 // 46 //
diff --git a/js/document/views/design-code.js b/js/document/views/design-code.js
new file mode 100644
index 00000000..bf6e186f
--- /dev/null
+++ b/js/document/views/design-code.js
@@ -0,0 +1,106 @@
1/* <copyright>
2Copyright (c) 2012, Motorola Mobility LLC.
3All Rights Reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice,
9 this list of conditions and the following disclaimer.
10
11* Redistributions in binary form must reproduce the above copyright notice,
12 this list of conditions and the following disclaimer in the documentation
13 and/or other materials provided with the distribution.
14
15* Neither the name of Motorola Mobility LLC nor the names of its
16 contributors may be used to endorse or promote products derived from this
17 software without specific prior written permission.
18
19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29POSSIBILITY OF SUCH DAMAGE.
30</copyright> */
31
32////////////////////////////////////////////////////////////////////////
33//
34var Montage = require("montage/core/core").Montage,
35 Component = require("montage/ui/component").Component,
36 CodeDocumentView = require("js/document/views/code").CodeDocumentView;
37////////////////////////////////////////////////////////////////////////
38//Code View for the HTML file
39//
40exports.DesignCodeView = Montage.create(CodeDocumentView, {
41 ////////////////////////////////////////////////////////////////////
42 //
43 identifier: {
44 value: "design-code"
45 },
46 ////////////////////////////////////////////////////////////////////
47 //
48 init:{
49 value: function (content) {
50
51 }
52 },
53 ////////////////////////////////////////////////////////////////////
54 //
55 load:{
56 value:function(content){
57 //initialize the editor if not yet created
58 if(this.editor === null){
59 //todo: get the proper content
60 this.textArea.value = content;
61 this.initializeTextView(this.application.ninja.currentDocument.model.file, this.application.ninja.currentDocument);
62 return true;
63 }else{//reload the editor
64 this.editor.setValue(content);
65 this.editor.focus();
66 }
67 }
68 },
69 ////////////////////////////////////////////////////////////////////
70 //
71 show: {
72 value: function (callback) {
73 this.textViewContainer.setAttribute("class", "codeViewContainer cm-s-default");
74
75 this.textViewContainer.style.display = "block";
76
77 //todo : update options bar
78
79 //
80 if (callback) callback();
81 }
82 },
83 ////////////////////////////////////////////////////////////////////
84 //
85 hide: {
86 value: function (callback) {
87 if(this.editor){
88 this.editor.save();//save to textarea
89 }
90 this.textViewContainer.style.display = "none";
91
92 //todo : update options bar
93
94 //
95 if (callback) callback();
96 }
97 },
98 ////////////////////////////////////////////////////////////////////
99 //
100 applyTheme:{
101 value:function(themeClass){
102 //Todo: change for bucket structure of documents
103 this.textViewContainer.className = "codeViewContainer "+themeClass;
104 }
105 }
106}); \ No newline at end of file
diff --git a/js/document/views/design.js b/js/document/views/design.js
index 548e45e9..97558408 100755
--- a/js/document/views/design.js
+++ b/js/document/views/design.js
@@ -39,8 +39,8 @@ var Montage = require("montage/core/core").Montage,
39exports.DesignDocumentView = Montage.create(BaseDocumentView, { 39exports.DesignDocumentView = Montage.create(BaseDocumentView, {
40 //////////////////////////////////////////////////////////////////// 40 ////////////////////////////////////////////////////////////////////
41 // 41 //
42 hasTemplate: { 42 identifier: {
43 value: false 43 value: "design"
44 }, 44 },
45 //////////////////////////////////////////////////////////////////// 45 ////////////////////////////////////////////////////////////////////
46 // 46 //