diff options
author | Jose Antonio Marquez | 2012-02-14 22:30:51 -0800 |
---|---|---|
committer | Jose Antonio Marquez | 2012-02-14 22:30:51 -0800 |
commit | e327eccb93e2bc513fcbb7ab302783d6bce83884 (patch) | |
tree | e7e4ae87cd1c3e3f4a568514947c30c7e3ce2f07 /js | |
parent | 39d95b0f26aa38fcad4bb388446232a16ee72644 (diff) | |
download | ninja-e327eccb93e2bc513fcbb7ab302783d6bce83884.tar.gz |
Creating NinjaTemplate to HTML function
This function will need to be cleaned up and possibly moved once the MVC structure is in-place for the document.
Diffstat (limited to 'js')
-rwxr-xr-x | js/document/text-document.js | 9 | ||||
-rw-r--r-- | js/mediators/io-mediator.js | 22 |
2 files changed, 16 insertions, 15 deletions
diff --git a/js/document/text-document.js b/js/document/text-document.js index f2b7b0d8..6f8efaad 100755 --- a/js/document/text-document.js +++ b/js/document/text-document.js | |||
@@ -191,14 +191,5 @@ var TextDocument = exports.TextDocument = Montage.create(Montage, { | |||
191 | value: function() { | 191 | value: function() { |
192 | // Have the XHR here? | 192 | // Have the XHR here? |
193 | } | 193 | } |
194 | }/* | ||
195 | , | ||
196 | |||
197 | save:{ | ||
198 | value:function(){ | ||
199 | //base function - to be overridden | ||
200 | } | ||
201 | } | 194 | } |
202 | */ | ||
203 | |||
204 | }); \ No newline at end of file | 195 | }); \ No newline at end of file |
diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js index 599b7d84..2008e40f 100644 --- a/js/mediators/io-mediator.js +++ b/js/mediators/io-mediator.js | |||
@@ -142,12 +142,7 @@ exports.IoMediator = Montage.create(Component, { | |||
142 | // | 142 | // |
143 | switch (file.mode) { | 143 | switch (file.mode) { |
144 | case 'html': | 144 | case 'html': |
145 | file.document.content.document.body.innerHTML = file.body; | 145 | contents = this.parseNinjaTemplateToHtml(file); |
146 | file.document.content.document.head.innerHTML = file.head; | ||
147 | if (file.style) { | ||
148 | file.document.content.document.head.getElementsByTagName('style')[0].innerHTML = this.getCssFromRules(file.style.cssRules); | ||
149 | } | ||
150 | contents = file.document.content.document.documentElement.outerHTML; | ||
151 | break; | 146 | break; |
152 | default: | 147 | default: |
153 | contents = file.content; | 148 | contents = file.content; |
@@ -189,6 +184,21 @@ exports.IoMediator = Montage.create(Component, { | |||
189 | } | 184 | } |
190 | }, | 185 | }, |
191 | //////////////////////////////////////////////////////////////////// | 186 | //////////////////////////////////////////////////////////////////// |
187 | //TODO: Expand to allow more templates | ||
188 | parseNinjaTemplateToHtml: { | ||
189 | enumerable: false, | ||
190 | value: function (template) { | ||
191 | // | ||
192 | template.document.content.document.body.innerHTML = template.body; | ||
193 | template.document.content.document.head.innerHTML = template.head; | ||
194 | //TODO: Remove temp fix for styles | ||
195 | if (template.style) { | ||
196 | template.document.content.document.head.getElementsByTagName('style')[0].innerHTML = this.getCssFromRules(template.style.cssRules); | ||
197 | } | ||
198 | return template.document.content.document.documentElement.outerHTML; | ||
199 | } | ||
200 | }, | ||
201 | //////////////////////////////////////////////////////////////////// | ||
192 | //Method to return a string from CSS rules (to be saved to a file) | 202 | //Method to return a string from CSS rules (to be saved to a file) |
193 | getCssFromRules: { | 203 | getCssFromRules: { |
194 | enumerable: false, | 204 | enumerable: false, |