aboutsummaryrefslogtreecommitdiff
path: root/js/mediators
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-02-09 23:42:04 -0800
committerJose Antonio Marquez2012-02-09 23:42:04 -0800
commitfbe830fabe497d01f4f2eaddb867161a8187c101 (patch)
treef5a5e8a45e0108996de33547194605648f3b068a /js/mediators
parente8f7453c2b70960c63f81b5ec81d8e642a609900 (diff)
downloadninja-fbe830fabe497d01f4f2eaddb867161a8187c101.tar.gz
Adding download cloud app UI
Diffstat (limited to 'js/mediators')
-rw-r--r--js/mediators/io-mediator.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js
index 630b0aa2..2f286e5e 100644
--- a/js/mediators/io-mediator.js
+++ b/js/mediators/io-mediator.js
@@ -86,16 +86,17 @@ exports.IoMediator = Montage.create(Component, {
86 case 204: 86 case 204:
87 //Creating and formatting result object for callbak 87 //Creating and formatting result object for callbak
88 result = read.file.details; 88 result = read.file.details;
89 //TODO: Add handling for converting HTML to Ninja format 89 //Checking for type of content to returns
90 if (result.extension !== 'html' && result.extension !== 'htm') { 90 if (result.extension !== 'html' && result.extension !== 'htm') {
91 //Simple string
91 result.content = read.file.content; 92 result.content = read.file.content;
92 } else { 93 } else {
93 // 94 //Object to be used by Ninja Template
94 result.content = this.parseHtmlToNinjaTemplate(read.file.content); 95 result.content = this.parseHtmlToNinjaTemplate(read.file.content);
95 } 96 }
96 97 //Status of call
97 result.status = read.status; 98 result.status = read.status;
98 // 99 //Calling back with result
99 if (callback) callback(result); 100 if (callback) callback(result);
100 break; 101 break;
101 case 404: 102 case 404:
@@ -143,7 +144,7 @@ exports.IoMediator = Montage.create(Component, {
143 // 144 //
144 fileSaveAs: { 145 fileSaveAs: {
145 enumerable: false, 146 enumerable: false,
146 value: function (file, copy, callback) { 147 value: function (copyTo, copyFrom, callback) {
147 // 148 //
148 } 149 }
149 }, 150 },
@@ -152,13 +153,12 @@ exports.IoMediator = Montage.create(Component, {
152 parseHtmlToNinjaTemplate: { 153 parseHtmlToNinjaTemplate: {
153 enumerable: false, 154 enumerable: false,
154 value: function (html) { 155 value: function (html) {
156 //Creating temp object to mimic HTML
155 var doc = window.document.implementation.createHTMLDocument(), template; 157 var doc = window.document.implementation.createHTMLDocument(), template;
156 // 158 //Setting content to temp
157 doc.getElementsByTagName('html')[0].innerHTML = html; 159 doc.getElementsByTagName('html')[0].innerHTML = html;
158 template = {head: doc.head, body: doc.body, document: doc}; 160 //Creating return object
159 doc = null; 161 return {head: doc.head.innerHTML, body: doc.body.innerHTML, document: doc};
160 //
161 return template;
162 } 162 }
163 } 163 }
164 //////////////////////////////////////////////////////////////////// 164 ////////////////////////////////////////////////////////////////////