Made a lot of changes :
Added 'changed' and 'free' hour classes Did overal tweaks Moved around some jade for better consistency
This commit is contained in:
parent
9be6daa221
commit
3f138bf055
|
@ -6,3 +6,9 @@ html
|
|||
script(type="text/javascript", src="http://code.jquery.com/jquery-1.11.3.min.js")
|
||||
script(type="text/javascript", src="/js/script.js")
|
||||
|
||||
body
|
||||
div.bar
|
||||
|
||||
h1#title(class=!url ? 'big' : '') Werkmanrooster
|
||||
span V
|
||||
span 5
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
include header
|
||||
|
||||
body
|
||||
div.bar
|
||||
|
||||
div.homepage
|
||||
h1 Werkmanrooster
|
||||
span V
|
||||
span 5
|
||||
|
||||
input#search(type="text", name="searchterm", placeholder="Je naam, id, klassennaam, docentencode, lokaalcode")
|
||||
button Zoeken
|
||||
input.search(type="text", name="searchterm", placeholder="Je naam, id, klassennaam, docentencode, lokaalcode")
|
||||
button.search Zoeken
|
||||
|
|
|
@ -1,10 +1,17 @@
|
|||
//- schedule.jade
|
||||
|
||||
include header
|
||||
include search
|
||||
|
||||
div.schedule
|
||||
each day in json
|
||||
each day in match.json
|
||||
div.day
|
||||
each hour in day
|
||||
div.hour
|
||||
if hour.teacher != 'vrij\r'
|
||||
div.hour(class=hour.changed == 'true' ? 'changed' : '')
|
||||
span.teacher= hour.teacher
|
||||
span.chamber= hour.chamber
|
||||
span.course= hour.course
|
||||
else
|
||||
div.hour.changed
|
||||
span.free Vrij
|
||||
|
|
3
resources/jade/search.jade
Normal file
3
resources/jade/search.jade
Normal file
|
@ -0,0 +1,3 @@
|
|||
//- search.jade
|
||||
input.search(type="text", name="searchterm", placeholder="Je naam, id, klassennaam, docentencode, lokaalcode", value=(match.first_name || match.name) + '\'s rooster')
|
||||
button.search Zoeken
|
|
@ -1,20 +1,23 @@
|
|||
$(document).ready(function () {
|
||||
|
||||
$('#search').on('keyup', function (e) {
|
||||
$('input.search').on('keyup', function (e) {
|
||||
if (e.keyCode == 13) {
|
||||
go();
|
||||
}
|
||||
});
|
||||
|
||||
$('button').click(function () {
|
||||
$('button.search').click(function () {
|
||||
go();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function go() {
|
||||
var searchterm = $('#search').val().trim();
|
||||
var searchterm = $('.search').val().trim();
|
||||
if (!!searchterm) {
|
||||
document.location.pathname = '/rooster/' + searchterm;
|
||||
}
|
||||
else {
|
||||
document.location.pathname = '/';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,41 +1,20 @@
|
|||
//style.less
|
||||
@import url('http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,700,400');
|
||||
@import url('http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,700,400|Oswald');
|
||||
|
||||
.homepage {
|
||||
text-align: center;
|
||||
|
||||
h1 {
|
||||
font-size: 8rem;
|
||||
font-family: Open Sans;
|
||||
letter-spacing: 0px;
|
||||
.big {
|
||||
margin-top: 20%;
|
||||
}
|
||||
|
||||
span {
|
||||
font-size: 2rem;
|
||||
letter-spacing: -2px;
|
||||
position: relative;
|
||||
left: -35px;
|
||||
|
||||
> span {
|
||||
color: #96AA48;
|
||||
position: relative;
|
||||
left: -2px;
|
||||
top: 1px;
|
||||
display: inline-block;
|
||||
-webkit-transform: rotate(15deg);
|
||||
}
|
||||
}
|
||||
|
||||
input {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
button {
|
||||
display: block;
|
||||
.search {
|
||||
margin: 0 auto;
|
||||
width: 50%;
|
||||
display: block;
|
||||
font-family: Open Sans;
|
||||
}
|
||||
|
||||
input.search {
|
||||
text-align: center;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.bar {
|
||||
|
@ -45,14 +24,77 @@
|
|||
margin-bottom: 50px;
|
||||
}
|
||||
|
||||
h1#title {
|
||||
font-size: 8rem;
|
||||
font-family: Oswald;
|
||||
letter-spacing: 0px;
|
||||
text-align: center;
|
||||
text-transform: uppercase;
|
||||
|
||||
span {
|
||||
font-size: 3rem;
|
||||
letter-spacing: -2px;
|
||||
position: relative;
|
||||
left: -12px;
|
||||
top: -1px;
|
||||
-webkit-transform: rotate(-7deg);
|
||||
display: inline-block;
|
||||
|
||||
> span {
|
||||
color: #96AA48;
|
||||
position: relative;
|
||||
left: -3px;
|
||||
top: 1px;
|
||||
display: inline-block;
|
||||
-webkit-transform: rotate(11deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
div.schedule {
|
||||
display: table;
|
||||
margin: 10px auto;
|
||||
border: solid 1px #e1e1e1;
|
||||
font-family: Open Sans;
|
||||
|
||||
div.day {
|
||||
float: left;
|
||||
|
||||
div.hour {
|
||||
height: 20px;
|
||||
border-bottom: solid 1px #DDD;
|
||||
padding: 12px 15px;
|
||||
border-bottom: 1px solid #e1e1e1;
|
||||
width: 150px;
|
||||
border-left: 1px solid #FFF;
|
||||
|
||||
span {
|
||||
display: inline-block;
|
||||
width: 33%;
|
||||
}
|
||||
|
||||
.teacher {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.chamber {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.course {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
&.changed {
|
||||
color: red !important;
|
||||
}
|
||||
|
||||
.free {
|
||||
.changed;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ function to_json(page) {
|
|||
var schedule = cheerio('tr:nth-child('+ (6 + hour) +')', result);
|
||||
|
||||
//Looping for (optional) specialhours
|
||||
var amount_of_special_hours = schedule.find('table').eq(0).children().length;
|
||||
var amount_of_special_hours = schedule.find('table').eq(day).children().length;
|
||||
for (special_hour = 0; special_hour < amount_of_special_hours; special_hour++) {
|
||||
schedule_data[day][hour] = {teacher: [], chamber: [], course: [], changed: []};
|
||||
var selected_hour = schedule.find('table').eq(day).find('tr').eq(special_hour).find('td');
|
||||
|
|
5
web.js
5
web.js
|
@ -7,6 +7,7 @@ var lookup = require('./lookup.js');
|
|||
var schedule = require('./schedule.js');
|
||||
|
||||
app.set('view engine', 'jade');
|
||||
app.disable('view cache');
|
||||
app.set('views', __dirname + '/resources/jade');
|
||||
app.use('/css', less(__dirname + '/resources/less'));
|
||||
app.use('/js', express.static(__dirname + '/resources/js'));
|
||||
|
@ -32,8 +33,8 @@ app.param('search', lookup);
|
|||
app.param('search', schedule);
|
||||
|
||||
app.param('search', function (req, res) {
|
||||
res.render('schedule', req.match);
|
||||
console.log(req.match.json[0][0]);
|
||||
res.render('schedule', req);
|
||||
console.log(req);
|
||||
});
|
||||
|
||||
app.listen(1024);
|
||||
|
|
Loading…
Reference in a new issue