mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-23 17:00:24 +01:00
added custom routing from server side, started moving hardcoded scripts into create_route
This commit is contained in:
@@ -58,7 +58,7 @@ var templates = {};
|
|||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
loadTemplates([
|
loadTemplates([
|
||||||
'header', 'footer', 'register', 'home', 'topic','account', 'category',
|
'header', 'footer', 'register', 'home', 'topic','account', 'category', 'users',
|
||||||
'login', 'reset', 'reset_code', 'account',
|
'login', 'reset', 'reset_code', 'account',
|
||||||
'confirm',
|
'confirm',
|
||||||
'emails/reset', 'emails/reset_plaintext', 'emails/email_confirm', 'emails/email_confirm_plaintext'
|
'emails/reset', 'emails/reset_plaintext', 'emails/email_confirm', 'emails/email_confirm_plaintext'
|
||||||
|
|||||||
@@ -122,6 +122,10 @@ passport.deserializeUser(function(uid, done) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function create_route(url, tpl) {
|
||||||
|
return '<script>templates.ready(function(){ajaxify.go("' + url + '", null, "' + tpl + '");});</script>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Basic Routes (entirely client-side parsed, goal is to move the rest of the crap in this file into this one section)
|
// Basic Routes (entirely client-side parsed, goal is to move the rest of the crap in this file into this one section)
|
||||||
(function() {
|
(function() {
|
||||||
@@ -137,7 +141,7 @@ passport.deserializeUser(function(uid, done) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
res.send(templates['header'] + '<script>templates.ready(function(){ajaxify.go("' + route + '");});</script>' + templates['footer']);
|
res.send(templates['header'] + create_route(route) + templates['footer']);
|
||||||
});
|
});
|
||||||
}(routes[i]));
|
}(routes[i]));
|
||||||
}
|
}
|
||||||
@@ -217,7 +221,9 @@ passport.deserializeUser(function(uid, done) {
|
|||||||
break;
|
break;
|
||||||
case 'users' :
|
case 'users' :
|
||||||
if (String(req.params.section).toLowerCase() === 'edit') {
|
if (String(req.params.section).toLowerCase() === 'edit') {
|
||||||
|
get_account_fn(req, res, function(userData) {
|
||||||
|
res.send(JSON.stringify(userData));
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
get_account_fn(req, res, function(userData) {
|
get_account_fn(req, res, function(userData) {
|
||||||
res.send(JSON.stringify(userData));
|
res.send(JSON.stringify(userData));
|
||||||
@@ -390,7 +396,8 @@ passport.deserializeUser(function(uid, done) {
|
|||||||
console.log("ARE U HERE");
|
console.log("ARE U HERE");
|
||||||
user.getUserList(function(data){
|
user.getUserList(function(data){
|
||||||
//res.send(data);
|
//res.send(data);
|
||||||
res.send(templates['header'] + '<script>templates.ready(function(){ajaxify.go("users");});</script>' + templates['footer']);
|
res.send(templates['header'] + create_route("users", "users") + templates['footer']);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user