aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/controllers/system.js
diff options
context:
space:
mode:
authorDennis Eriksen <dennis.se@gmail.com>2013-05-23 17:17:16 +0200
committerDennis Eriksen <dennis.se@gmail.com>2013-05-23 17:17:16 +0200
commit59ee9f2325a31a9900b56ff182a77372948e5fe2 (patch)
treed509d5403b770a4e0f6bbfe7fb304ac772b94c89 /controllers/system.js
parentadded method to get recent activity for all projects a user belongs to (diff)
downloadDivid-59ee9f2325a31a9900b56ff182a77372948e5fe2.tar.gz
fixed recent activity
Diffstat (limited to 'controllers/system.js')
-rw-r--r--controllers/system.js17
1 files changed, 14 insertions, 3 deletions
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
});
-
+*/
});
});