fixed a bug in templates, introduced categories, added default setup script onload, moved home.tpl code over to category, created hierachies

This commit is contained in:
psychobunny
2013-05-06 22:05:42 +00:00
parent 178bc82a55
commit fa64e84dcc
8 changed files with 72 additions and 48 deletions

View File

@@ -147,6 +147,10 @@ passport.deserializeUser(function(uid, done) {
res.send(templates['header'] + '<script>templates.ready(function(){ajaxify.go("' + 'topic/' + req.params.topic_id + '");});</script>' + templates['footer']);
});
app.get('/category/:category_id/:slug?', function(req, res) {
res.send(templates['header'] + '<script>templates.ready(function(){ajaxify.go("' + 'category/' + req.params.category_id + '");});</script>' + templates['footer']);
});
app.get('/confirm/:code', function(req, res) {
res.send(templates['header'] + '<script>templates.ready(function(){ajaxify.go("' + 'confirm/' + req.params.code + '");});</script>' + templates['footer']);
});
@@ -155,7 +159,7 @@ passport.deserializeUser(function(uid, done) {
function api_method(req, res) {
switch(req.params.method) {
case 'home' :
global.modules.topics.get(function(data) {
global.modules.categories.get(function(data) {
res.send(JSON.stringify(data));
});
break;
@@ -185,6 +189,12 @@ passport.deserializeUser(function(uid, done) {
res.send(JSON.stringify(data));
}, req.params.id, (req.user) ? req.user.uid : 0);
break;
case 'category' :
global.modules.topics.get(function(data) {
console.log(data);
res.send(JSON.stringify(data));
}, req.params.id);
break;
case 'account' :
get_account_fn(req, res, function(userData) {
res.send(JSON.stringify(userData));