Skip to content

Commit 30fe399

Browse files
committed
Update editor to use new app structure.
Import/export is not fully functional yet.
1 parent c9a9b91 commit 30fe399

File tree

1 file changed

+11
-11
lines changed
  • coder-apps/common/editor/app

1 file changed

+11
-11
lines changed

coder-apps/common/editor/app/app.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ exports.api_getcode_handler = function( app, req, res, pathmatches ) {
9090
return;
9191
}
9292
var outdata = {
93-
htmldata: getFile( path + '/views/apps/' + apptoedit + '/index.html' ),
94-
jsdata: getFile( path + '/static/apps/' + apptoedit + '/js/index.js' ),
95-
cssdata: getFile( path + '/static/apps/' + apptoedit + '/css/index.css' ),
96-
appdata: getFile( path + '/apps/' + apptoedit + '/app.js' )
93+
htmldata: getFile( path + '/apps/' + apptoedit + '/views/index.html' ),
94+
jsdata: getFile( path + '/apps/' + apptoedit + '/static/js/index.js' ),
95+
cssdata: getFile( path + '/apps/' + apptoedit + '/static/css/index.css' ),
96+
appdata: getFile( path + '/apps/' + apptoedit + '/app/app.js' )
9797
};
9898

9999
res.json( outdata );
@@ -119,7 +119,7 @@ exports.api_media_remove_handler = function( app, req, res ) {
119119
return;
120120
}
121121

122-
var fpath = process.cwd() + '/static/apps/' + appname + '/media/' + fname;
122+
var fpath = process.cwd() + '/apps/' + appname + '/static/media/' + fname;
123123
util.log("MEDIA DELETE: " + fpath );
124124
err = fs.unlinkSync( fpath );
125125
if ( !err ) {
@@ -149,7 +149,7 @@ exports.api_media_upload_handler = function( app, req, res ) {
149149
res.json( {status: 'error', error: "couldn't read file"} );
150150
return;
151151
}
152-
var path = process.cwd() + '/static/apps/' + appname + '/media/' + fname;
152+
var path = process.cwd() + '/apps/' + appname + '/static/media/' + fname;
153153
fs.writeFile(path, data, function (err) {
154154
if ( !err ) {
155155
res.json({
@@ -188,13 +188,13 @@ exports.api_savecode_handler = function( app, req, res, pathmatches ) {
188188
var data = req.param('data');
189189
var filepath = null;
190190
if ( datatype === 'css' ) {
191-
filepath = path + '/static/apps/' + apptoedit + '/css/index.css'
191+
filepath = path + '/apps/' + apptoedit + '/static/css/index.css'
192192
} else if ( datatype === 'html' ) {
193-
filepath = path + '/views/apps/' + apptoedit + '/index.html'
193+
filepath = path + '/apps/' + apptoedit + '/views/index.html'
194194
} else if ( datatype === 'js' ) {
195-
filepath = path + '/static/apps/' + apptoedit + '/js/index.js'
195+
filepath = path + '/apps/' + apptoedit + '/static/js/index.js'
196196
} else if ( datatype === 'app' ) {
197-
filepath = path + '/apps/' + apptoedit + '/app.js'
197+
filepath = path + '/apps/' + apptoedit + '/app/app.js'
198198
}
199199

200200
coderlib.app(apptoedit, function(err, app) {
@@ -272,7 +272,7 @@ exports.api_savesettings_handler = function( app, req, res, pathmatches ) {
272272

273273
exports.listMedia = function( appname ) {
274274
var path = process.cwd(); //root application path. different from __dirname
275-
var mediadir = path + "/static/apps/" + appname + "/media/";
275+
var mediadir = path + "/apps/" + appname + "/static/media/";
276276
var media = {};
277277
var files = fs.readdirSync(mediadir);
278278
for ( var x in files ) {

0 commit comments

Comments
 (0)