Integrated configuration variables into the app.

Also renamed config().links to config().linkbar
This commit is contained in:
Bram van der Veen 2015-07-22 15:50:05 +02:00
parent 86998dac7a
commit cc2e7cf806
2 changed files with 5 additions and 6 deletions

View file

@ -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']

9
web.js
View file

@ -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);
}]);