aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/controllers/system.js
diff options
context:
space:
mode:
authorDennis Eriksen <dennis.se@gmail.com>2013-05-25 11:17:42 +0200
committerDennis Eriksen <dennis.se@gmail.com>2013-05-25 11:17:42 +0200
commite582c3b84c6090b08f33d599c354968fcd868d14 (patch)
treeb6de1b7b1f708bf9126ccb709d5129e91a67c7d5 /controllers/system.js
parentchanged what gets collected (diff)
downloadDivid-e582c3b84c6090b08f33d599c354968fcd868d14.tar.gz
moved and renamed files to match the filesetup we want.
havebeen using a dev-setup till now.
Diffstat (limited to '')
-rw-r--r--app/controllers/system.js (renamed from controllers/system.js)35
1 files changed, 9 insertions, 26 deletions
diff --git a/controllers/system.js b/app/controllers/system.js
index c29e06f..0e63083 100644
--- a/controllers/system.js
+++ b/app/controllers/system.js
@@ -4,7 +4,7 @@
*/
var mongoose = require('mongoose')
, env = process.env.NODE_ENV || 'development'
- , config = require('../config/config.js')[env]
+ , config = require('../../config/config.js')[env]
, Project = mongoose.model('Project')
, Access = mongoose.model('Access')
, User = mongoose.model('User')
@@ -36,23 +36,6 @@ exports.index = function(req, res) {
};
-
-exports.test = function(req, res) {
- res.render('test', {
- title: 'test',
- user: req.user
- });
-};
-
-
-exports.home = function(req, res) {
- res.render('home', {
- title: 'home',
- user: req.user
- });
-};
-
-
exports.faq = function(req, res) {
res.render('faq', {
title: 'faq',
@@ -159,7 +142,7 @@ exports.dashboard = function(req, res) {
exports.project = function(req, res) {
Project.loadShort(req.params.short, function(err, project) {
- if (err) return res.status(500).render('error', { title: '500', text: 'En serverfeil oppstod', error: err.stack });
+ if (err || !project) return res.status(500).render('error', { title: '500', text: 'En serverfeil oppstod', error: err });
Access.loadProject(project._id, function(err, access) {
if (err) return res.status(500).render('error', { title: '500', text: 'En serverfeil oppstod', error: err.stack });
pPost.loadProject(project._id, function(err, posts) {
@@ -207,7 +190,7 @@ exports.project = function(req, res) {
if (pro.user[i].diff > 0) pro.user[i].coeff = pro.user[i].diff / pro.otot;
}
console.log(pro);
- res.render('project', {
+ res.render('project/project', {
title: project.name
, user: req.user
, req: req
@@ -228,7 +211,7 @@ exports.projectParticipants = function(req, res) {
if (req.header('Referer') === undefined) { return res.status(403).render('error', { title: 403, text: 'Du har ikke tilgang til denne siden. Du må registrere deg først. Sjekk mailen din for å se invitekode.' }); }
else { return res.redirect('back'); }
}
- res.render('projectParticipants', { title: 'Prosjektdeltakere', user: req.user });
+ res.render('project/participants', { title: 'Prosjektdeltakere', user: req.user });
}
@@ -241,7 +224,7 @@ exports.projectPost = function(req, res) {
Project.loadShort(req.params.short, function(err, project) {
if (err) return res.status(500).render('error', { title: '500', text: 'En serverfeil oppstod', error: err.stack });
req.project = project;
- res.render('projectPost', { title: 'Legg til utgift', user: req.user, req: req, project: project });
+ res.render('project/post', { title: 'Legg til utgift', user: req.user, req: req, project: project });
});
@@ -278,7 +261,7 @@ exports.postProjectPost = function(req, res) {
ppost.value = sanitize(req.body.value).toInt(); // this will remove leading zeroes. '0123' => '123'
ppost.when = new Date(sanitize(req.body.date).escape() + ' ' + sanitize(req.body.time).escape() + ':00');
ppost.save(function(err) {
- if (err) return res.render('projectPost', { title: 'Legg til utgift - en feil oppstod', user: req.user, req: req, project: project });
+ if (err) return res.render('project/post', { title: 'Legg til utgift - en feil oppstod', user: req.user, req: req, project: project });
return res.redirect('/project/' + project.shortURL);
});
});
@@ -290,7 +273,7 @@ exports.newProject = function(req, res) {
else { return res.redirect('back'); }
}
- res.render('newProject', { title: 'Nytt prosjekt', user: req.user });
+ res.render('project/newProject', { title: 'Nytt prosjekt', user: req.user });
}
exports.postNewProject = function(req, res) {
@@ -304,7 +287,7 @@ exports.postNewProject = function(req, res) {
project.save(function(err) {
if (err) {
console.log(err.errors);
- return res.render('newproject', { title: 'Nytt prosjekt - en feil oppstod', user: req.user, errors: err.errors, project: project });
+ return res.render('project/newProject', { title: 'Nytt prosjekt - en feil oppstod', user: req.user, errors: err.errors, project: project });
}
var access = new Access();
access.user = req.user._id;
@@ -314,7 +297,7 @@ exports.postNewProject = function(req, res) {
access.save(function(err) {
if (err) {
console.log(err.errors);
- return res.render('newproject', { title: 'Nytt prosjekt - en feil oppstod', user: req.user });
+ return res.render('project/newProject', { title: 'Nytt prosjekt - en feil oppstod', user: req.user });
}
return res.redirect('/dashboard');
});