diff options
author | Jose Antonio Marquez | 2012-02-13 15:03:23 -0800 |
---|---|---|
committer | Jose Antonio Marquez | 2012-02-13 15:03:23 -0800 |
commit | 018a6132d93a73d28bd349122404c236e61cb765 (patch) | |
tree | 3f5c0131842536b11be3890d1656c056fefa0597 | |
parent | 1b84b4549934578caaad38ef14b34cba35e2622a (diff) | |
download | ninja-018a6132d93a73d28bd349122404c236e61cb765.tar.gz |
Save 'code' view files
Added functionality (temp) to save files in code view.
-rwxr-xr-x | js/controllers/document-controller.js | 4 | ||||
-rwxr-xr-x | js/io/document/html-document.js | 7 | ||||
-rwxr-xr-x | js/io/document/text-document.js | 65 | ||||
-rwxr-xr-x | js/io/ui/cloudpopup.reel/cloudpopup.html | 2 | ||||
-rw-r--r-- | js/mediators/io-mediator.js | 1 |
5 files changed, 58 insertions, 21 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 227b5462..9f9e4757 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -100,10 +100,10 @@ DocumentController = exports.DocumentController = Montage.create(Component, { | |||
100 | 100 | ||
101 | 101 | ||
102 | //////////////////////////////////////////////////////////////////// | 102 | //////////////////////////////////////////////////////////////////// |
103 | //TODO: Improve logic and make functions | 103 | //TODO: Check for appropiate structures |
104 | handleExecuteSave: { | 104 | handleExecuteSave: { |
105 | value: function(event) { | 105 | value: function(event) { |
106 | // | 106 | //Text and HTML document classes should return the same save object for fileSave |
107 | this.application.ninja.ioMediator.fileSave(this.activeDocument.save()); | 107 | this.application.ninja.ioMediator.fileSave(this.activeDocument.save()); |
108 | } | 108 | } |
109 | }, | 109 | }, |
diff --git a/js/io/document/html-document.js b/js/io/document/html-document.js index 99bf4576..dfd8566a 100755 --- a/js/io/document/html-document.js +++ b/js/io/document/html-document.js | |||
@@ -471,9 +471,12 @@ var HTMLDocument = exports.HTMLDocument = Montage.create(baseDocumentModule.Base | |||
471 | save: { | 471 | save: { |
472 | enumerable: false, | 472 | enumerable: false, |
473 | value: function () { | 473 | value: function () { |
474 | //console.log(this._styles, this._stylesheets); | ||
475 | //TODO: Add code view logic and also styles for HTML | 474 | //TODO: Add code view logic and also styles for HTML |
476 | return {mode: 'html', document: this._userDocument, style: this._styles, head: this._templateDocument.head.innerHTML, body: this._templateDocument.body.innerHTML}; | 475 | if (this.currentView === 'design') { |
476 | return {mode: 'html', document: this._userDocument, style: this._styles, head: this._templateDocument.head.innerHTML, body: this._templateDocument.body.innerHTML}; | ||
477 | } else if(this.currentView === "code"){ | ||
478 | //TODO: Would this get call when we are in code of HTML? | ||
479 | } | ||
477 | } | 480 | } |
478 | } | 481 | } |
479 | //////////////////////////////////////////////////////////////////// | 482 | //////////////////////////////////////////////////////////////////// |
diff --git a/js/io/document/text-document.js b/js/io/document/text-document.js index 81162eba..e149c479 100755 --- a/js/io/document/text-document.js +++ b/js/io/document/text-document.js | |||
@@ -4,11 +4,13 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | 4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. |
5 | </copyright> */ | 5 | </copyright> */ |
6 | 6 | ||
7 | var Montage = require("montage/core/core").Montage; | 7 | //////////////////////////////////////////////////////////////////////// |
8 | var baseDocumentModule = require("js/io/document/base-document"); | 8 | // |
9 | 9 | var Montage = require("montage/core/core").Montage, | |
10 | 10 | BaseDocument = require("js/io/document/base-document").BaseDocument; | |
11 | var TextDocument = exports.TextDocument = Montage.create(baseDocumentModule.BaseDocument, { | 11 | //////////////////////////////////////////////////////////////////////// |
12 | // | ||
13 | var TextDocument = exports.TextDocument = Montage.create(BaseDocument, { | ||
12 | // PRIVATE MEMBERS | 14 | // PRIVATE MEMBERS |
13 | _codeEditor: { | 15 | _codeEditor: { |
14 | value: { | 16 | value: { |
@@ -21,7 +23,9 @@ var TextDocument = exports.TextDocument = Montage.create(baseDocumentModule.Base | |||
21 | _hline: { value: null, enumerable: false }, | 23 | _hline: { value: null, enumerable: false }, |
22 | 24 | ||
23 | _textArea: {value: null, enumerable: false }, | 25 | _textArea: {value: null, enumerable: false }, |
24 | 26 | ||
27 | _userDocument: {value: null, enumerable: false }, | ||
28 | |||
25 | _source: { value: null, enumerable: false}, | 29 | _source: { value: null, enumerable: false}, |
26 | 30 | ||
27 | source: { | 31 | source: { |
@@ -65,19 +69,43 @@ var TextDocument = exports.TextDocument = Montage.create(baseDocumentModule.Base | |||
65 | }, | 69 | }, |
66 | 70 | ||
67 | 71 | ||
68 | // PUBLIC METHODS | 72 | //////////////////////////////////////////////////////////////////// |
73 | // | ||
69 | initialize: { | 74 | initialize: { |
70 | value: function(doc, uuid, textArea, container, callback) { | 75 | value: function(file, uuid, textArea, container, callback) { |
71 | this.init(doc.name, doc.uri, doc.type, container, uuid); | 76 | // |
72 | this.currentView = "code"; | 77 | this._userDocument = file; |
73 | this.textArea = textArea; | 78 | // |
74 | 79 | this.init(file.name, file.uri, file.extension, container, uuid, callback); | |
75 | // this._loadContent(); | 80 | // |
76 | 81 | this.currentView = "code"; | |
82 | this.textArea = textArea; | ||
77 | } | 83 | } |
78 | }, | 84 | }, |
85 | //////////////////////////////////////////////////////////////////// | ||
86 | // | ||
87 | save: { | ||
88 | enumerable: false, | ||
89 | value: function () { | ||
90 | //TODO: Improve sequence | ||
91 | this.editor.save(); | ||
92 | return {mode: this._userDocument.extension, document: this._userDocument, content: this.textArea.value}; | ||
93 | } | ||
94 | } | ||
95 | //////////////////////////////////////////////////////////////////// | ||
96 | |||
97 | |||
98 | |||
99 | |||
100 | |||
101 | |||
102 | |||
103 | |||
104 | |||
105 | |||
79 | 106 | ||
80 | // PRIVATE METHODS | 107 | /* |
108 | // PRIVATE METHODS | ||
81 | _loadContent: { | 109 | _loadContent: { |
82 | value: function() { | 110 | value: function() { |
83 | // Start and AJAX call to load the HTML Document as a String | 111 | // Start and AJAX call to load the HTML Document as a String |
@@ -104,11 +132,15 @@ var TextDocument = exports.TextDocument = Montage.create(baseDocumentModule.Base | |||
104 | xhr.send(''); | 132 | xhr.send(''); |
105 | } | 133 | } |
106 | }, | 134 | }, |
135 | */ | ||
136 | //////////////////////////////////////////////////////////////////// | ||
137 | |||
107 | 138 | ||
108 | /** | 139 | /** |
109 | * public method | 140 | * public method |
110 | */ | 141 | */ |
111 | save:{ | 142 | /* |
143 | save:{ | ||
112 | value:function(){ | 144 | value:function(){ |
113 | try{ | 145 | try{ |
114 | this.editor.save(); | 146 | this.editor.save(); |
@@ -120,4 +152,5 @@ var TextDocument = exports.TextDocument = Montage.create(baseDocumentModule.Base | |||
120 | } | 152 | } |
121 | } | 153 | } |
122 | } | 154 | } |
155 | */ | ||
123 | }); \ No newline at end of file | 156 | }); \ No newline at end of file |
diff --git a/js/io/ui/cloudpopup.reel/cloudpopup.html b/js/io/ui/cloudpopup.reel/cloudpopup.html index 8e65a705..2c1c169a 100755 --- a/js/io/ui/cloudpopup.reel/cloudpopup.html +++ b/js/io/ui/cloudpopup.reel/cloudpopup.html | |||
@@ -50,7 +50,7 @@ | |||
50 | 50 | ||
51 | <h4>Install Ninja Cloud App</h4> | 51 | <h4>Install Ninja Cloud App</h4> |
52 | 52 | ||
53 | <p>Donec congue lacinia dui, a porttitor lectus condimentum laoreet. Nunc eu ullamcorper orci. Quisque eget odio ac lectus.</p> | 53 | <p>The Local Cloud App is required to run Ninja. Please download and unzip the file. Start the Local Cloud and copy/paste the server URL into the field above. Click the ‘Test’ button to verify the connection.</p> |
54 | 54 | ||
55 | <div class="cloud_icon"></div> | 55 | <div class="cloud_icon"></div> |
56 | 56 | ||
diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js index 35e0ca5a..47069cfb 100644 --- a/js/mediators/io-mediator.js +++ b/js/mediators/io-mediator.js | |||
@@ -150,6 +150,7 @@ exports.IoMediator = Montage.create(Component, { | |||
150 | contents = file.document.content.document.documentElement.outerHTML; | 150 | contents = file.document.content.document.documentElement.outerHTML; |
151 | break; | 151 | break; |
152 | default: | 152 | default: |
153 | contents = file.content; | ||
153 | break; | 154 | break; |
154 | } | 155 | } |
155 | // | 156 | // |