Added multiple_found and not_found pages for search handling

This commit is contained in:
Bram van der Veen 2015-06-24 16:32:13 +02:00
parent 7ae5d70872
commit cfd665c311
4 changed files with 57 additions and 3 deletions

View file

@ -23,11 +23,11 @@ function lookup(req, res, next, search) {
next();
}
else if (database_entry.length == 0) {
res.send('No matches were found in the database.');
res.render('not_found');
}
else {
res.send('Multiple hits were found in the database.');
console.log(database_entry);
req.found = database_entry;
res.render('multiple_found', req);
}
});
}

View file

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

View file

@ -0,0 +1,4 @@
//- not_found.jade
include header
h6.container.center.notfound Er zijn geen resultaten gevonden met je zoekopdracht, kijk het nog even goed en probeer het nog eens.
include search

View file

@ -5,6 +5,46 @@
margin-top: 10%;
}
.center {
text-align: center;
}
.notfound {
margin: 20px auto;
}
ul.found {
list-style: none;
text-align: center;
margin-top: 20px;
li {
border-bottom: solid 1px #AAA;
border-top: solid 1px #DDD;
padding: 0;
margin: 0 auto;
font-size: 25px;
width: 50%;
a {
text-decoration: none;
color: inherit;
}
&:last-child {
border-bottom: none;
}
&:first-child {
border-top: none;
}
&:hover {
background-color: #E1E1E1;
}
}
}
.search {
margin: 0 auto;
width: 50%;