From 59ee9f2325a31a9900b56ff182a77372948e5fe2 Mon Sep 17 00:00:00 2001 From: Dennis Eriksen Date: Thu, 23 May 2013 17:17:16 +0200 Subject: fixed recent activity --- controllers/system.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'controllers') diff --git a/controllers/system.js b/controllers/system.js index 03a73d3..ffbb16b 100644 --- a/controllers/system.js +++ b/controllers/system.js @@ -95,13 +95,24 @@ exports.dashboard = function(req, res) { Access.loadUser(req.user._id, function(err, projects) { if (err) return res.status(500).render('error', { title: '500', text: 'En serverfeil oppstod', error: err.stack }); Project.populate(projects, { path: 'project.user', model: User }, function(err, projects) { - - res.render('dashboard', { + var projectIDs = []; + projects.forEach(function(project) { projectIDs.push(project.project._id); console.log(project.project.name); }); + pPost.loadByProjects(projectIDs, function(err, posts) { + console.log(posts); + if (err) return res.status(500).render('error', { title: '500', text: 'En serverfeil oppstod', error: err.stack }); + res.render('dashboard', { + title: 'Dashboard', + user: req.user, + projects: projects, + posts: posts + }); + }); + /* res.render('dashboard', { title: 'Dashboard', user: req.user, projects: projects }); - +*/ }); }); -- cgit v1.2.3