nedap usability

This commit is contained in:
Astro 2010-12-10 17:26:23 +01:00
parent 942dd0dfd9
commit 12aef47d43
2 changed files with 33 additions and 4 deletions

View File

@ -10,7 +10,7 @@ var backend, question, answers, scores;
function html(body) {
return "<!DOCTYPE html>\n" +
"<html><head><title>Pentanews Game Show</title></head>\n" +
/* TODO: CSS */
"<link href='style.css' rel='stylesheet' type='text/css'>" +
"<body><h1>Pentanews Game Show</h1>\n" +
body +
"</body></html>";
@ -43,7 +43,7 @@ console.log({question:question,answers:answers})
res.end();
} else {
res.writeHead(404, { 'Content-type': 'text/html' });
res.write(html('o_0'));
res.write(html('<p>No question left on server.</p>'));
res.end();
}
});
@ -56,8 +56,8 @@ console.log({question:question,answers:answers})
scores[i]++;
backend.send(JSON.stringify({ scores: scores }));
res.writeHead(200, { 'Content-type': 'text/html' });
res.write(html("<p>Thanks</p>"));
res.writeHead(303, { 'Content-type': 'text/html',
'Location': '/thanks' });
res.end();
} else {
res.writeHead(400, { 'Content-type': 'text/html' });
@ -68,6 +68,12 @@ console.log({question:question,answers:answers})
res.end();
}
});
app.get('/thanks', function(req, res) {
res.writeHead(200, { 'Content-type': 'text/html' });
res.write(html("<p>Thanks, your vote may have been counted.</p>"));
res.end();
});
}

23
nedap/static/style.css Normal file
View File

@ -0,0 +1,23 @@
body {
margin: 0 auto;
width: 30em;
color: white;
background-color: #20203f;
text-align: center;
font-family: sans-serif;
}
p, ul {
text-align: left;
}
ul {
list-style-type: none;
background-color: #30304f;
padding: 0.5em;
}
input[type=radio] {
padding: 0.2em;
margin: 0;
}