aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/controllers/system.js
diff options
context:
space:
mode:
authorDennis Eriksen <dennis.se@gmail.com>2013-04-29 14:24:43 +0200
committerDennis Eriksen <dennis.se@gmail.com>2013-04-29 14:24:43 +0200
commit7ffbad817125e0767ff51ae7b3ddd9092328bafc (patch)
tree263cd285ca4b06c7c13cc6f92e3cf7739be9bfc1 /controllers/system.js
parentadded button for new project (diff)
downloadDivid-7ffbad817125e0767ff51ae7b3ddd9092328bafc.tar.gz
been working on the project model and posting projects
Diffstat (limited to 'controllers/system.js')
-rw-r--r--controllers/system.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/controllers/system.js b/controllers/system.js
index f04ec6d..e3a55bd 100644
--- a/controllers/system.js
+++ b/controllers/system.js
@@ -2,7 +2,8 @@
/**
* Module dependencies
*/
-
+var mongoose = require('mongoose')
+ , Project = mongoose.model('Project');
@@ -69,3 +70,11 @@ exports.newProject = function(req, res) {
res.render('newproject', { title: 'Nytt prosjekt', loggedin: true });
}
+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 });
+ return res.redirect('/dashboard');
+ });
+}
+