Skip to content

Instantly share code, notes, and snippets.

@mikevalstar
Created April 17, 2011 22:17
Show Gist options
  • Save mikevalstar/924525 to your computer and use it in GitHub Desktop.
Save mikevalstar/924525 to your computer and use it in GitHub Desktop.
app.post('/admin/ajax/theme.:format', function(req, res){ aServ.ajax.theme(req, res); });
theme: function(req, res){
if( !this._start(req, res) ) return;
var Status = this.Status;
cb_func = function(theme, error){
if(error){
res.send({ status: 404, message: "Theme not found: " + error});
return;
}
res.send({ status: 200, message: "Theme loaded", theme: theme, current: theme.theme == Status.Theme.theme });
}
if( req.body && req.body.current ){
cb_func(this.Status.Theme, false);
}else if(req.body && req.body.id){
var theme = new Theme();
theme.Load(req.body.id, this.Status.themepath, cb_func);
}else{
res.send({ status: 403, message: "Missing parameter: id"});
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment