Added multiple_found and not_found pages for search handling
This commit is contained in:
parent
7ae5d70872
commit
cfd665c311
|
@ -23,11 +23,11 @@ function lookup(req, res, next, search) {
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
else if (database_entry.length == 0) {
|
else if (database_entry.length == 0) {
|
||||||
res.send('No matches were found in the database.');
|
res.render('not_found');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
res.send('Multiple hits were found in the database.');
|
req.found = database_entry;
|
||||||
console.log(database_entry);
|
res.render('multiple_found', req);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
10
resources/jade/multiple_found.jade
Normal file
10
resources/jade/multiple_found.jade
Normal 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
|
||||||
|
|
4
resources/jade/not_found.jade
Normal file
4
resources/jade/not_found.jade
Normal 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
|
|
@ -5,6 +5,46 @@
|
||||||
margin-top: 10%;
|
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 {
|
.search {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
width: 50%;
|
width: 50%;
|
||||||
|
|
Loading…
Reference in a new issue