mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-24 01:10:31 +01:00
custom template half in
This commit is contained in:
@@ -25,7 +25,7 @@ var ajaxify = {};
|
|||||||
// ajaxify.go(document.location.href.replace(rootUrl +'/', ''));
|
// ajaxify.go(document.location.href.replace(rootUrl +'/', ''));
|
||||||
};
|
};
|
||||||
|
|
||||||
ajaxify.go = function(url, callback) {
|
ajaxify.go = function(url, callback, custom_tpl) {
|
||||||
|
|
||||||
// leave room and join global
|
// leave room and join global
|
||||||
app.enter_room('global');
|
app.enter_room('global');
|
||||||
@@ -49,7 +49,7 @@ var ajaxify = {};
|
|||||||
}
|
}
|
||||||
|
|
||||||
jQuery('#content, #footer').fadeIn(250);
|
jQuery('#content, #footer').fadeIn(250);
|
||||||
});
|
}, custom_tpl);
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -147,17 +147,20 @@ var templates = {};
|
|||||||
|
|
||||||
}());
|
}());
|
||||||
|
|
||||||
function load_template(callback) {
|
function load_template(callback, custom_tpl) {
|
||||||
var location = document.location || window.location,
|
var location = document.location || window.location,
|
||||||
rootUrl = location.protocol + '//' + (location.hostname || location.host) + (location.port ? ':' + location.port : '');
|
rootUrl = location.protocol + '//' + (location.hostname || location.host) + (location.port ? ':' + location.port : '');
|
||||||
|
|
||||||
var url = location.href.replace(rootUrl +'/', '');
|
var url = location.href.replace(rootUrl +'/', '');
|
||||||
url = (url === '' || url === '/') ? 'home' : url;
|
url = (url === '' || url === '/') ? 'home' : url;
|
||||||
|
|
||||||
|
|
||||||
jQuery.get(API_URL + url, function(data) {
|
jQuery.get(API_URL + url, function(data) {
|
||||||
var tpl = url.split('/')[0];
|
var tpl = url.split('/')[0];
|
||||||
tpl = templates.get_custom_map(tpl);
|
tpl = templates.get_custom_map(tpl);
|
||||||
|
|
||||||
|
if (custom_tpl) tpl = custom_tpl;
|
||||||
|
|
||||||
document.getElementById('content').innerHTML = templates[tpl].parse(JSON.parse(data));
|
document.getElementById('content').innerHTML = templates[tpl].parse(JSON.parse(data));
|
||||||
if (callback) callback();
|
if (callback) callback();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -216,10 +216,13 @@ passport.deserializeUser(function(uid, done) {
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'users' :
|
case 'users' :
|
||||||
|
if (String(req.params.section).toLowerCase() === 'edit') {
|
||||||
get_account_fn(req, res, function(userData) {
|
|
||||||
res.send(JSON.stringify(userData));
|
} else {
|
||||||
});
|
get_account_fn(req, res, function(userData) {
|
||||||
|
res.send(JSON.stringify(userData));
|
||||||
|
});
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'confirm':
|
case 'confirm':
|
||||||
global.modules.user.email.confirm(req.params.id, function(data) {
|
global.modules.user.email.confirm(req.params.id, function(data) {
|
||||||
@@ -243,9 +246,13 @@ passport.deserializeUser(function(uid, done) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
app.get('/api/:method', api_method);
|
app.get('/api/:method', api_method);
|
||||||
app.get('/api/:method/:id', 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.get('/api/:method/:id*', api_method);
|
||||||
|
|
||||||
|
|
||||||
app.post('/login', passport.authenticate('local', {
|
app.post('/login', passport.authenticate('local', {
|
||||||
successRedirect: '/',
|
successRedirect: '/',
|
||||||
|
|||||||
Reference in New Issue
Block a user