Changed the name of "multiple_found.jade" to "list.jade" and

Added linkbar to most other pages
Made sure that auth.is is called when lookup.get calls that multiple
matches are found.
This commit is contained in:
Bram van der Veen 2015-07-22 16:28:41 +02:00
parent d5528422f7
commit d7d17de5d8
6 changed files with 14 additions and 15 deletions

View file

@ -25,7 +25,9 @@ function get(req, res, next, search) {
} }
else { else {
req.match = database_entry; req.match = database_entry;
res.render('multiple_found', req); require('./auth').is(req, res, function () {
res.render('list', req);
});
} }
}); });
} }

View file

@ -1,6 +1,11 @@
//- list.jade //- list.jade
include header include header
include search
div=JSON.stringify(match, null, 2) .container
ul.found
for entry in match
li
a(href='/rooster/' + entry.name)=entry.name
include linkbar include linkbar

View file

@ -11,3 +11,5 @@ include header
input(type="password", name="password") input(type="password", name="password")
div div
input(type="submit", value="Log In").button-primary input(type="submit", value="Log In").button-primary
include linkbar

View file

@ -1,10 +0,0 @@
//- multiple_found.jade
include header
include search
.container
ul.found
for entry in match
li
a(href='/rooster/' + entry.name)=entry.name

View file

@ -1,3 +1,3 @@
//- search.jade //- search.jade
input.search(type="text", name="searchterm", placeholder="Je naam, id, klassennaam, docentencode, lokaalcode", value=path.split('/')[1] == 'klassenlijst' ? 'Leerlingen van ' + match[0].group : match ? ((match.first_name || match.name) + '\'s rooster') : '') input.search(type="text", name="searchterm", placeholder="Je naam, id, klassennaam, docentencode, lokaalcode", value=path.split('/')[1] == 'klassenlijst' ? 'Leerlingen van ' + match[0].group : match ? ((match.first_name || match.name || 'Meerdere mensen hun rooster') + '\'s rooster') : '')
button.search Zoeken button.search Zoeken

2
web.js
View file

@ -49,7 +49,7 @@ app.get('/rooster/:search', [auth.is, schedule.get, function (req, res) {
app.param('list', lookup.list); app.param('list', lookup.list);
app.get('/klassenlijst/:list',[auth.is, function (req, res) { app.get('/klassenlijst/:list',[auth.is, function (req, res) {
res.render('multiple_found', req); res.render('list', req);
}]); }]);
app.listen(config().web_port); app.listen(config().web_port);