From cc2e7cf8065c71bc3d628dec3098659ff012bcc7 Mon Sep 17 00:00:00 2001 From: Bram van der Veen <96aa48@gmail.com> Date: Wed, 22 Jul 2015 15:50:05 +0200 Subject: [PATCH] Integrated configuration variables into the app. Also renamed config().links to config().linkbar --- configuration.js | 2 +- web.js | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/configuration.js b/configuration.js index 0d9182b..d21244f 100644 --- a/configuration.js +++ b/configuration.js @@ -22,7 +22,7 @@ module.exports = function () { '15:40 - 16:40' ], 'school_id' : 934, - 'links' : { + 'linkbar' : { 'Login': ['http://roosters5.gepro-osi.nl/roosters/rooster.php?school=INSERTYOURSCHOOL_ID', '#CCCC99'], 'Magister': ['http://INSERTYOURMAGISTER.magister.net', '#0C5489'], 'Mail': ['https://login.microsoftonline.com/', '#C41824'] diff --git a/web.js b/web.js index 103ce37..22d6d7a 100644 --- a/web.js +++ b/web.js @@ -17,13 +17,16 @@ app.set('view engine', 'jade'); config().env == 'dev' ? app.disable('view cache') : null; //If the environment is set on 'dev' then view cache should be disabled. app.set('views', __dirname + '/resources/jade'); +//Give the app some configuration information +app.local.linkbar = config().linkbar; +app.local.hour_times = config().hour_times; + //Set up all static directories for getting resources. app.use('/css', less(__dirname + '/resources/less')); app.use('/js', express.static(__dirname + '/resources/js')); app.use('/other', express.static(__dirname + '/resources/other')); app.get('/', auth.is, function (req, res) { - req.links = config().links; res.render('homepage', req); }); @@ -40,16 +43,12 @@ app.param('api', api); app.param('search', lookup.get); app.get('/rooster/:search', [auth.is, schedule.get, function (req, res) { - req.links = config().links; - req.times = config().hour_times; res.render('schedule', req); }]); app.param('list', lookup.list); app.get('/klassenlijst/:list',[auth.is, function (req, res) { - req.links = config().links; - req.times = config().hour_times; res.render('multiple_found', req); }]);