Skip to content

Node.js based forum software built for the modern web

custom template half in

psychobunny09c6aace0927
diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js
index 716c26d977..9423be6c23 100644
--- a/public/src/ajaxify.js
+++ b/public/src/ajaxify.js
@@ -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;
diff --git a/public/src/templates.js b/public/src/templates.js
index babefa961b..1c6bb44741 100644
--- a/public/src/templates.js
+++ b/public/src/templates.js
@@ -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();
});
diff --git a/src/webserver.js b/src/webserver.js
index 6ba71f8dcb..4afdaf1cd2 100644
--- a/src/webserver.js
+++ b/src/webserver.js
@@ -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: '/',