Added new resources for frontend.

Also made the frontend work.
This commit is contained in:
Bram van der Veen 2015-06-13 23:35:44 +02:00
parent 4fd90684e8
commit f35a4d21fe
8 changed files with 719 additions and 4 deletions

View file

@ -12,7 +12,6 @@ function lookup(req, res, next, search) {
if (database_entry.length == 1) { if (database_entry.length == 1) {
database_entry[0].url = make_url(database_entry[0]); database_entry[0].url = make_url(database_entry[0]);
req.match = database_entry[0]; req.match = database_entry[0];
next(); next();
} }
else if (database_entry.length == 0) { else if (database_entry.length == 0) {

View file

@ -11,6 +11,7 @@
"dependencies": { "dependencies": {
"cheerio": "^0.19.0", "cheerio": "^0.19.0",
"express": "^4.12.4", "express": "^4.12.4",
"express-less": "0.0.7",
"jade": "^1.11.0", "jade": "^1.11.0",
"mongodb": "^1.4.38", "mongodb": "^1.4.38",
"mongoskin": "^1.4.13" "mongoskin": "^1.4.13"

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -0,0 +1,18 @@
html
head
title Werkmanrooster
link(rel="stylesheet", href="/css/skeleton.css", type="text/css")
link(rel="stylesheet", href="/css/style.css", type="text/css")
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
div.homepage
h1 Werkmanrooster
span V
span 5
input#search(type="text", name="searchterm", placeholder="Je naam, id, klassennaam, docentencode, lokaalcode")
button Zoeken

8
resources/js/script.js Normal file
View file

@ -0,0 +1,8 @@
// $(document).ready(function () {
//
// // $('#search')
//
// $('button').click(function () {
// document.
// });
// });

626
resources/less/skeleton.less vendored Normal file
View file

@ -0,0 +1,626 @@
/*
* Skeleton V2.0.4
* Copyright 2014, Dave Gamache
* www.getskeleton.com
* Free to use under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
* 12/29/2014
* Less Version by Seth Coelen https://github.com/whatsnewsaes
*/
/* Table of contents
- Grid
- Base Styles
- Typography
- Links
- Buttons
- Forms
- Lists
- Code
- Tables
- Spacing
- Utilities
- Clearing
- Media Queries
*/
// Variables
//
// Breakpoints
@bp-larger-than-mobile : 400px;
@bp-larger-than-phablet : 550px;
@bp-larger-than-tablet : 750px;
@bp-larger-than-desktop : 1000px;
@bp-larger-than-desktophd : 1200px;
// Colors
@light-grey: #e1e1e1;
@dark-grey: #333;
@primary-color: #33c3f0;
@secondary-color: lighten(@dark-grey, 13.5%);
@border-color: #bbb;
@link-color: #1eaedb;
@font-color: #222;
// Typography
@font-family: "Raleway", "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;
// Grid Variables
@container-width: 960px;
@container-width-larger-than-mobile: 85%;
@container-width-larger-than-phablet: 80%;
@total-columns: 12;
@column-width: 100 / @total-columns; // calculates individual column width based off of # of columns
@column-margin: 4%; // space between columns
// Misc
@global-radius: 4px;
// Functions
//
.grid-column-width(@n) {
width: @column-width * @n - (@column-margin*(@total-columns - @n)/@total-columns);
}
.grid-offset-length(@n) {
margin-left: @column-width * @n - (@column-margin*(@total-columns - @n)/@total-columns) + @column-margin;
}
/* Grid
*/
.container {
position: relative;
width: 100%;
max-width: @container-width;
margin: 0 auto;
padding: 0 20px;
box-sizing: border-box;
}
.column,
.columns {
width: 100%;
float: left;
box-sizing: border-box;
}
/* For devices larger than 400px */
@media (min-width: @bp-larger-than-mobile) {
.container {
width: @container-width-larger-than-mobile;
padding: 0;
}
}
/* For devices larger than 550px */
@media (min-width: @bp-larger-than-phablet) {
.container {
width: @container-width-larger-than-phablet;
}
.column,
.columns {
margin-left: @column-margin;
}
.column:first-child,
.columns:first-child {
margin-left: 0;
}
.one.column,
.one.columns { .grid-column-width(1); }
.two.columns { .grid-column-width(2); }
.three.columns { .grid-column-width(3); }
.four.columns { .grid-column-width(4); }
.five.columns { .grid-column-width(5); }
.six.columns { .grid-column-width(6); }
.seven.columns { .grid-column-width(7); }
.eight.columns { .grid-column-width(8); }
.nine.columns { .grid-column-width(9); }
.ten.columns { .grid-column-width(10); }
.eleven.columns { .grid-column-width(11); }
.twelve.columns { width: 100%; margin-left: 0; }
.one-third.column { .grid-column-width(4); }
.two-thirds.column { .grid-column-width(8); }
.one-half.column { .grid-column-width(6); }
/* Offsets */
.offset-by-one.column,
.offset-by-one.columns { .grid-offset-length(1); }
.offset-by-two.column,
.offset-by-two.columns { .grid-offset-length(2); }
.offset-by-three.column,
.offset-by-three.columns { .grid-offset-length(3); }
.offset-by-four.column,
.offset-by-four.columns { .grid-offset-length(4); }
.offset-by-five.column,
.offset-by-five.columns { .grid-offset-length(5); }
.offset-by-six.column,
.offset-by-six.columns { .grid-offset-length(6); }
.offset-by-seven.column,
.offset-by-seven.columns { .grid-offset-length(7); }
.offset-by-eight.column,
.offset-by-eight.columns { .grid-offset-length(8); }
.offset-by-nine.column,
.offset-by-nine.columns { .grid-offset-length(9); }
.offset-by-ten.column,
.offset-by-ten.columns { .grid-offset-length(10); }
.offset-by-eleven.column,
.offset-by-eleven.columns { .grid-offset-length(11); }
.offset-by-one-third.column,
.offset-by-one-third.columns { .grid-offset-length(4); }
.offset-by-two-thirds.column,
.offset-by-two-thirds.columns { .grid-offset-length(8); }
.offset-by-one-half.column,
.offset-by-one-half.column { .grid-offset-length(6); }
}
/* Base Styles
*/
/* NOTE
html is set to 62.5% so that all the REM measurements throughout Skeleton
are based on 10px sizing. So basically 1.5rem = 15px :) */
html {
font-size: 62.5%;
}
body {
font-size: 1.5em; /* currently ems cause chrome bug misinterpreting rems on body element */
line-height: 1.6;
font-weight: 400;
font-family: @font-family;
color: @font-color;
padding: 0px;
margin: 0px;
}
/* Typography
*/
h1, h2, h3, h4, h5, h6 {
margin-top: 0;
margin-bottom: 2rem;
font-weight: 300;
}
h1 { font-size: 4.0rem; line-height: 1.2; letter-spacing: -.1rem; }
h2 { font-size: 3.6rem; line-height: 1.25; letter-spacing: -.1rem; }
h3 { font-size: 3.0rem; line-height: 1.3; letter-spacing: -.1rem; }
h4 { font-size: 2.4rem; line-height: 1.35; letter-spacing: -.08rem; }
h5 { font-size: 1.8rem; line-height: 1.5; letter-spacing: -.05rem; }
h6 { font-size: 1.5rem; line-height: 1.6; letter-spacing: 0; }
/* Larger than phablet */
@media (min-width: @bp-larger-than-phablet) {
h1 { font-size: 5.0rem; }
h2 { font-size: 4.2rem; }
h3 { font-size: 3.6rem; }
h4 { font-size: 3.0rem; }
h5 { font-size: 2.4rem; }
h6 { font-size: 1.5rem; }
}
p {
margin-top: 0;
}
/* Links
*/
a {
color: @link-color;
&:hover {
color: darken(@link-color, 5%);
}
}
/* Buttons
*/
.button,
button {
display: inline-block;
height: 38px;
padding: 0 30px;
color: @secondary-color;
text-align: center;
font-size: 11px;
font-weight: 600;
line-height: 38px;
letter-spacing: .1rem;
text-transform: uppercase;
text-decoration: none;
white-space: nowrap;
background-color: transparent;
border-radius: @global-radius;
border: 1px solid @border-color;
cursor: pointer;
box-sizing: border-box;
}
input {
&[type="submit"],
&[type="reset"],
&[type="button"] {
display: inline-block;
height: 38px;
padding: 0 30px;
color: @secondary-color;
text-align: center;
font-size: 11px;
font-weight: 600;
line-height: 38px;
letter-spacing: .1rem;
text-transform: uppercase;
text-decoration: none;
white-space: nowrap;
background-color: transparent;
border-radius: @global-radius;
border: 1px solid @border-color;
cursor: pointer;
box-sizing: border-box;
}
}
.button:hover,
button:hover {
color: @dark-grey;
border-color: lighten(@dark-grey, 33.3%);
outline: 0;
}
input {
&[type="submit"]:hover,
&[type="reset"]:hover,
&[type="button"]:hover {
color: @dark-grey;
border-color: lighten(@dark-grey, 33.3%);
outline: 0;
}
}
.button:focus,
button:focus {
color: @dark-grey;
border-color: lighten(@dark-grey, 33.3%);
outline: 0;
}
input {
&[type="submit"]:focus,
&[type="reset"]:focus,
&[type="button"]:focus {
color: @dark-grey;
border-color: lighten(@dark-grey, 33.3%);
outline: 0;
}
}
.button.button-primary,
button.button-primary {
color: #fff;
background-color: @primary-color;
border-color: @primary-color;
}
input {
&[type="submit"].button-primary,
&[type="reset"].button-primary,
&[type="button"].button-primary {
color: #fff;
background-color: @primary-color;
border-color: @primary-color;
}
}
.button.button-primary:hover,
button.button-primary:hover {
color: #fff;
background-color: @link-color;
border-color: @link-color;
}
input {
&[type="submit"].button-primary:hover,
&[type="reset"].button-primary:hover,
&[type="button"].button-primary:hover {
color: #fff;
background-color: @link-color;
border-color: @link-color;
}
}
.button.button-primary:focus,
button.button-primary:focus {
color: #fff;
background-color: @link-color;
border-color: @link-color;
}
input {
&[type="submit"].button-primary:focus,
&[type="reset"].button-primary:focus,
&[type="button"].button-primary:focus {
color: #fff;
background-color: @link-color;
border-color: @link-color;
}
&[type="email"],
&[type="number"],
&[type="search"],
&[type="text"],
&[type="tel"],
&[type="url"],
&[type="password"] {
height: 38px;
padding: 6px 10px; // The 6px vertically centers text on FF, ignored by Webkit
background-color: #fff;
border: 1px solid lighten(@border-color, 8.8%);
border-radius: @global-radius;
box-shadow: none;
box-sizing: border-box;
}
}
/* Forms
*/
textarea,
select {
height: 38px;
padding: 6px 10px; /* The 6px vertically centers text on FF, ignored by Webkit */
background-color: #fff;
border: 1px solid lighten(@border-color, 8.8%);
border-radius: @global-radius;
box-shadow: none;
box-sizing: border-box;
}
/* Removes awkward default styles on some inputs for iOS */
input {
&[type="email"],
&[type="number"],
&[type="search"],
&[type="text"],
&[type="tel"],
&[type="url"],
&[type="password"] {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
}
textarea {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
min-height: 65px;
padding-top: 6px;
padding-bottom: 6px;
}
input {
&[type="email"]:focus,
&[type="number"]:focus,
&[type="search"]:focus,
&[type="text"]:focus,
&[type="tel"]:focus,
&[type="url"]:focus,
&[type="password"]:focus {
border: 1px solid @primary-color;
outline: 0;
}
}
textarea:focus,
select:focus {
border: 1px solid @primary-color;
outline: 0;
}
label,
legend {
display: block;
margin-bottom: .5rem;
font-weight: 600;
}
fieldset {
padding: 0;
border-width: 0;
}
input {
&[type="checkbox"],
&[type="radio"] {
display: inline;
}
}
label > .label-body {
display: inline-block;
margin-left: .5rem;
font-weight: normal;
}
/* Lists
*/
ul {
list-style: circle inside;
}
ol {
list-style: decimal inside;
padding-left: 0;
margin-top: 0;
}
ul {
padding-left: 0;
margin-top: 0;
ul, ol {
margin: 1.5rem 0 1.5rem 3rem;
font-size: 90%;
}
}
ol {
ol, ul {
margin: 1.5rem 0 1.5rem 3rem;
font-size: 90%;
}
}
li {
margin-bottom: 1rem;
}
/* Code
*/
code {
padding: .2rem .5rem;
margin: 0 .2rem;
font-size: 90%;
white-space: nowrap;
background: lighten(@light-grey, 6.4%);
border: 1px solid @light-grey;
border-radius: @global-radius;
}
pre > code {
display: block;
padding: 1rem 1.5rem;
white-space: pre;
}
/* Tables
*/
th,
td {
padding: 12px 15px;
text-align: left;
border-bottom: 1px solid @light-grey;
}
th:first-child,
td:first-child {
padding-left: 0;
}
th:last-child,
td:last-child {
padding-right: 0;
}
/* Spacing
*/
button,
.button {
margin-bottom: 1rem;
}
input,
textarea,
select,
fieldset {
margin-bottom: 1.5rem;
}
pre,
blockquote,
dl,
figure,
table,
p,
ul,
ol,
form {
margin-bottom: 2.5rem;
}
/* Utilities
*/
.u-full-width {
width: 100%;
box-sizing: border-box;
}
.u-max-full-width {
max-width: 100%;
box-sizing: border-box;
}
.u-pull-right {
float: right;
}
.u-pull-left {
float: left;
}
/* Misc
*/
hr {
margin-top: 3rem;
margin-bottom: 3.5rem;
border-width: 0;
border-top: 1px solid @light-grey;
}
/* Clearing
*/
/* Self Clearing Goodness */
.container:after,
.row:after,
.u-cf {
content: "";
display: table;
clear: both;
}
/* Media Queries
*/
/*
Note: The best way to structure the use of media queries is to create the queries
near the relevant code. For example, if you wanted to change the styles for buttons
on small devices, paste the mobile query code up in the buttons section and style it
there.
*/
/* Larger than mobile */
@media (min-width: @bp-larger-than-mobile) {}
/* Larger than phablet (also point when grid becomes active) */
@media (min-width: @bp-larger-than-phablet) {}
/* Larger than tablet */
@media (min-width: @bp-larger-than-tablet) {}
/* Larger than desktop */
@media (min-width: @bp-larger-than-desktop) {}
/* Larger than Desktop HD */
@media (min-width: @bp-larger-than-desktophd) {}

46
resources/less/style.less Normal file
View file

@ -0,0 +1,46 @@
//style.less
@import url('http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,700,400');
.homepage {
text-align: center;
h1 {
font-size: 8rem;
font-family: Open Sans;
letter-spacing: 0px;
}
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;
margin: 0 auto;
width: 50%;
}
}
.bar {
height: 10px;
width: 100%;
background-color: #96aa48;
margin-bottom: 50px;
}

23
web.js
View file

@ -1,23 +1,40 @@
//web.js //web.js
var express = require('express'); var express = require('express');
var less = require('express-less');
var app = express(); var app = express();
var lookup = require('./lookup.js'); var lookup = require('./lookup.js');
var schedule = require('./schedule.js'); var schedule = require('./schedule.js');
var render = require('./render.js');
app.set('view engine', 'jade');
app.set('views', __dirname + '/resources/jade');
app.use('/css', less(__dirname + '/resources/less'));
app.use('/js', express.static(__dirname + '/resources/js'));
app.get('/', function (req, res) { app.get('/', function (req, res) {
res.send('Hello world!'); res.render('homepage');
}); });
app.param('search', lookup); app.post('/', function (req, res) {
app.param('search', schedule); console.log(req);
// res.redirect('/rooster/' + req.body);
});
app.get('/rooster/:search', function (req, res) { app.get('/rooster/:search', function (req, res) {
next(); next();
}); });
app.get('/over', function (req, res) { app.get('/over', function (req, res) {
res.send('Hier kun je lezen over werkmanrooster.'); res.send('Hier kun je lezen over werkmanrooster.');
}); });
app.param('search', lookup);
app.param('search', schedule);
app.param('search', function (req, res) {
res.render('schedule', req.match);
});
app.listen(1024); app.listen(1024);