diff options
author | Dennis Eriksen <dennis.se@gmail.com> | 2013-04-30 09:09:55 +0200 |
---|---|---|
committer | Dennis Eriksen <dennis.se@gmail.com> | 2013-04-30 09:09:55 +0200 |
commit | f93cd061359f9060976d8209a0cc37d42b295edf (patch) | |
tree | a8b1854cc077852d9857a9a91fa7440f98526c69 /controllers | |
parent | changed port AGAIN (diff) | |
download | Divid-f93cd061359f9060976d8209a0cc37d42b295edf.tar.gz |
working with project listing
Diffstat (limited to 'controllers')
-rw-r--r-- | controllers/system.js | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/controllers/system.js b/controllers/system.js index e3a55bd..6bd9d22 100644 --- a/controllers/system.js +++ b/controllers/system.js @@ -54,11 +54,17 @@ exports.faq = function(req, res) { exports.dashboard = function(req, res) { console.log('/dashboard - ' + req.user); - res.render('dashboard', { - title: 'kanin', - loggedin: true + + Project.find(function(err, projects) { + if (err) return res.render('500'); + console.log(projects); + res.render('dashboard', { + title: 'Dashboad', + loggedin: true, + projects: projects + }); }); -}; +} @@ -73,7 +79,10 @@ exports.newProject = function(req, res) { exports.postNewProject = function(req, res) { var project = new Project(req.body); project.save(function(err) { - if (err) return res.render('newproject', { title: 'Nytt prosjekt - en feil oppstod', loggedin: true, errors: err.errors, project: project }); + if (err) { + console.log(err.errors); + return res.render('newproject', { title: 'Nytt prosjekt - en feil oppstod', loggedin: true, errors: err.errors, project: project }); + } return res.redirect('/dashboard'); }); } |