aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDennis Eriksen <dennis.se@gmail.com>2013-05-24 10:12:25 +0200
committerDennis Eriksen <dennis.se@gmail.com>2013-05-24 10:12:25 +0200
commitfcbd030b36426843acfb13ac567e80014910b628 (patch)
tree3945a49ddfedfb8eb6b3f124e9035e9f0b2838a1
parentadded some stuff (diff)
downloadDivid-fcbd030b36426843acfb13ac567e80014910b628.tar.gz
fixed some nicklists and other stuffs
-rw-r--r--controllers/system.js23
-rw-r--r--views/dashboard.ejs12
2 files changed, 23 insertions, 12 deletions
diff --git a/controllers/system.js b/controllers/system.js
index ffbb16b..07f6704 100644
--- a/controllers/system.js
+++ b/controllers/system.js
@@ -94,17 +94,21 @@ 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) {
- var projectIDs = [];
- projects.forEach(function(project) { projectIDs.push(project.project._id); console.log(project.project.name); });
+ var projectIDs = [];
+ projects.forEach(function(project) { projectIDs.push(project.project._id); console.log(project.project.name); });
+ Access.loadProjects(projectIDs, function(err, participants) {
+ if (err) return res.status(500).render('error', { title: '500', text: 'En serverfeil oppstod', error: err.stack });
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
+ Access.loadProjects(projectIDs, function(err, participants) {
+ 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,
+ participants: participants
+ });
});
});
/* res.render('dashboard', {
@@ -114,7 +118,6 @@ exports.dashboard = function(req, res) {
});
*/
});
-
});
/*
diff --git a/views/dashboard.ejs b/views/dashboard.ejs
index 1c1c4df..7fd41fa 100644
--- a/views/dashboard.ejs
+++ b/views/dashboard.ejs
@@ -18,10 +18,18 @@
<section class="project">
<div class="row-fluid">
<div class="span11">
- <h1><a href="/project/<%= projects.project.shortURL %>"><%= projects.project.user.username %>/<strong><%= projects.project.name %></strong></a></h1>
+ <h1><a href="/project/<%= projects.project.shortURL %>"><strong><%= projects.project.name %></strong></a></h1>
<div class="row-fluid">
<div class="span8">
- <small>Meg, Robert, Turid-Laila, Kurt, Stian, Aleksander, Frank, Olav, Heidi, Anette, Kristine</small>
+ <small>
+ <% var ppl = 'Meg';
+ participants.forEach(function(participant) {
+ if (String(participant.project) === String(projects.project._id) && String(participant.user._id) !== String(user._id)) {
+ ppl += ', ' + participant.user.name;
+ }
+ }); %>
+ <%- ppl %>
+ </small>
</div>
<div class="span4">
<small>Oppgjør: <span class="text-error">-200 kr</span></small>