aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--app.js2
-rw-r--r--controllers/system.js11
-rw-r--r--models/project.js2
-rw-r--r--views/newproject.ejs2
4 files changed, 12 insertions, 5 deletions
diff --git a/app.js b/app.js
index 492f8fe..f9aa1b9 100644
--- a/app.js
+++ b/app.js
@@ -10,7 +10,7 @@ var express = require('express')
/**
* App configuration
*/
-var port = process.env.PORT || 8001
+var port = process.env.PORT || 8000
, env = process.env.NODE_ENV || 'development'
, config = require('./config/config')[env]
, auth = require('./config/middlewares/authorization');
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');
+ });
+}
+
diff --git a/models/project.js b/models/project.js
index 52853d7..2424694 100644
--- a/models/project.js
+++ b/models/project.js
@@ -20,8 +20,6 @@ var ProjectSchema = new Schema({
updated: { type: Date, default: Date.now }
});
-console.log(Schema.ObjectId);
-
// the four validations below only apply if you are signing up traditionally
diff --git a/views/newproject.ejs b/views/newproject.ejs
index 3d0ff7c..e83673f 100644
--- a/views/newproject.ejs
+++ b/views/newproject.ejs
@@ -13,7 +13,7 @@
<form class="form-horizontal" action="/project/new" method="post">
<fieldset>
- <legend>Lag nytt prosjekt</legend>
+ <h1><legend><%= title %></legend></h1>
<div class="control-group">
<label class="control-label">Prosjektnavn</label>