aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/controllers/system.js
diff options
context:
space:
mode:
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
});
-
+*/
});
});