custom template half in

v1.18.x
psychobunny 12 years ago
parent cdceb39828
commit 09c6aace09

@ -25,7 +25,7 @@ var ajaxify = {};
// ajaxify.go(document.location.href.replace(rootUrl +'/', ''));
};
ajaxify.go = function(url, callback) {
ajaxify.go = function(url, callback, custom_tpl) {
// leave room and join global
app.enter_room('global');
@ -49,7 +49,7 @@ var ajaxify = {};
}
jQuery('#content, #footer').fadeIn(250);
});
}, custom_tpl);
return true;

@ -147,17 +147,20 @@ var templates = {};
}());
function load_template(callback) {
function load_template(callback, custom_tpl) {
var location = document.location || window.location,
rootUrl = location.protocol + '//' + (location.hostname || location.host) + (location.port ? ':' + location.port : '');
var url = location.href.replace(rootUrl +'/', '');
url = (url === '' || url === '/') ? 'home' : url;
jQuery.get(API_URL + url, function(data) {
var tpl = url.split('/')[0];
tpl = templates.get_custom_map(tpl);
if (custom_tpl) tpl = custom_tpl;
document.getElementById('content').innerHTML = templates[tpl].parse(JSON.parse(data));
if (callback) callback();
});

@ -216,10 +216,13 @@ passport.deserializeUser(function(uid, done) {
});
break;
case 'users' :
get_account_fn(req, res, function(userData) {
res.send(JSON.stringify(userData));
});
if (String(req.params.section).toLowerCase() === 'edit') {
} else {
get_account_fn(req, res, function(userData) {
res.send(JSON.stringify(userData));
});
}
break;
case 'confirm':
global.modules.user.email.confirm(req.params.id, function(data) {
@ -243,9 +246,13 @@ passport.deserializeUser(function(uid, done) {
break;
}
}
app.get('/api/:method', api_method);
app.get('/api/:method/:id', api_method);
// ok fine MUST ADD RECURSION style. I'll look for a better fix in future but unblocking baris for this:
app.get('/api/:method/:id/:section?', api_method);
app.get('/api/:method/:id*', api_method);
app.post('/login', passport.authenticate('local', {
successRedirect: '/',

Loading…
Cancel
Save