aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/controllers/system.js
diff options
context:
space:
mode:
authorLurifax <stianalexanderolsen@gmail.com>2013-04-29 14:49:39 +0200
committerLurifax <stianalexanderolsen@gmail.com>2013-04-29 14:49:39 +0200
commite0a8e93d0e691c3939a121f65e87dece50f6d97d (patch)
tree263cd285ca4b06c7c13cc6f92e3cf7739be9bfc1 /controllers/system.js
parentMerge branch 'master' of github.com:dennisse/Divid (diff)
parentbeen working on the project model and posting projects (diff)
downloadDivid-e0a8e93d0e691c3939a121f65e87dece50f6d97d.tar.gz
Merge branch 'master' of github.com:dennisse/Divid
Diffstat (limited to 'controllers/system.js')
-rw-r--r--controllers/system.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/controllers/system.js b/controllers/system.js
index cf205b9..e3a55bd 100644
--- a/controllers/system.js
+++ b/controllers/system.js
@@ -2,7 +2,8 @@
/**
* Module dependencies
*/
-
+var mongoose = require('mongoose')
+ , Project = mongoose.model('Project');
@@ -65,7 +66,15 @@ exports.project = function(req, res) {
res.render('project', { title: 'Harepus', loggedin: true });
}
-exports.newproject = function(req, res) {
+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');
+ });
+}
+