aboutsummaryrefslogtreecommitdiff
path: root/js/io/system/fileio.js
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-02-12 16:50:33 -0800
committerJose Antonio Marquez2012-02-12 16:50:33 -0800
commitb1fc4f84d92efeaa33ec239b662235c9e8218d0c (patch)
tree8f8c9aacb3c2a2315b8f44ca4400dfea95e21833 /js/io/system/fileio.js
parent9f2356c48b831d32d7278648656fe44b98bc4a1f (diff)
downloadninja-b1fc4f84d92efeaa33ec239b662235c9e8218d0c.tar.gz
File Save (HTML only)
Added the ability to save an HTML file from design view, need to add CSS detection and saving (of styles in <style> only). Also need to add 'Save All' for all file attached to the HTML file.
Diffstat (limited to 'js/io/system/fileio.js')
-rwxr-xr-xjs/io/system/fileio.js28
1 files changed, 27 insertions, 1 deletions
diff --git a/js/io/system/fileio.js b/js/io/system/fileio.js
index 045fa2fd..f363ef9f 100755
--- a/js/io/system/fileio.js
+++ b/js/io/system/fileio.js
@@ -104,13 +104,39 @@ exports.FileIo = Montage.create(Component, {
104 // 104 //
105 saveFile: { 105 saveFile: {
106 enumerable: true, 106 enumerable: true,
107 value: function() { 107 value: function(file) {
108 //Checking for API to be available 108 //Checking for API to be available
109 if (!this.application.ninja.coreIoApi.cloudAvailable()) { 109 if (!this.application.ninja.coreIoApi.cloudAvailable()) {
110 //API not available, no IO action taken 110 //API not available, no IO action taken
111 return null; 111 return null;
112 } 112 }
113 //Peforming check for file to exist
114 var check = this.application.ninja.coreIoApi.fileExists({uri: file.uri}), status, result;
115 //Upon successful check, handling results
116 if (check.success) {
117 //Handling status of check
118 switch (check.status) {
119 case 204:
120 //File exists
121 result = this.application.ninja.coreIoApi.updateFile(file);
122 status = 204;
123 break;
124 case 404://createFile
125 //File does not exists, ready to be created
126 result = this.application.ninja.coreIoApi.createFile(file);
127 status = 404;
128 break;
129 default:
130 //Unknown Error
131 status = 500;
132 break;
133 }
134 } else {
135 //Unknown Error
136 status = 500;
137 }
113 // 138 //
139 return {status: status, result: result};
114 } 140 }
115 }, 141 },
116 //////////////////////////////////////////////////////////////////// 142 ////////////////////////////////////////////////////////////////////