Added a MOTD system with a simple .json file
This commit is contained in:
parent
4fc5f4505a
commit
52cedd0ab4
4 changed files with 33 additions and 34 deletions
5
motd.json
Normal file
5
motd.json
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"header": "Op zoek naar nieuwe beheerder!",
|
||||
"body": "Hallo iedereen, ik ben dit jaar geslaagd!<br>Dit betekent echter wel dat het tijd is voor mij om Werkmanrooster door te geven aan de volgende beheerder die nog op Werkman zit. <br><br>Wil jij Werkmanrooster overnemen, stuur dan een mailtje naar werkmanrooster@gmail.com",
|
||||
"enabled": false
|
||||
}
|
||||
|
|
@ -1,16 +1,28 @@
|
|||
//style.less
|
||||
@import url('https://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,700,400|Oswald');
|
||||
|
||||
.notice {
|
||||
.motd {
|
||||
background-color: #BB4848;
|
||||
border: solid 1px #A22F2F;
|
||||
box-shadow: 0px 0px 5px #A53838;
|
||||
box-shadow: 0px 0px 10px #CECECE;
|
||||
width: 600px;
|
||||
padding: 15px;
|
||||
text-align: center;
|
||||
margin: 30px auto;
|
||||
border-radius: 3px;
|
||||
border-radius: 2px;
|
||||
color: #FFF;
|
||||
font-size: 13px;
|
||||
width: 300px;
|
||||
padding: 0;
|
||||
margin: 0 auto;
|
||||
|
||||
p {
|
||||
padding: 10px 10px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
> .bold {
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.night {
|
||||
|
|
@ -64,25 +76,6 @@ div.duringschool {
|
|||
text-align: center;
|
||||
}
|
||||
|
||||
.motd {
|
||||
border: solid 1px red;
|
||||
display: block;
|
||||
font-size: 13px;
|
||||
width: 300px;
|
||||
border: solid 1px #000;
|
||||
border-radius: 5px;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
top: 15px;
|
||||
left: 15px;
|
||||
|
||||
|
||||
p {
|
||||
padding: 10px 10px;
|
||||
margin: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
.notfound {
|
||||
margin: 20px auto;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,14 +23,16 @@
|
|||
|
||||
else
|
||||
ul
|
||||
li
|
||||
a(href="/login") Login
|
||||
li |
|
||||
li
|
||||
a(href="http://hoewerkt.werkmanrooster.nl", target="_blank") Hoe werkt Werkmanrooster?
|
||||
ul.right
|
||||
li
|
||||
a(href="http://hexli.me", target="_blank") The Dev
|
||||
a(href="http://hexli.me", target="_blank") Dev
|
||||
li |
|
||||
li
|
||||
a(href="http://github.com/96aa48/rooster.io", target="_blank") Github
|
||||
|
||||
if app.locals.motd.enabled
|
||||
.motd
|
||||
p.bold #{app.locals.motd.header}
|
||||
p!= app.locals.motd.body
|
||||
|
|
|
|||
11
web.js
11
web.js
|
|
@ -35,6 +35,7 @@ app.set('views', __dirname + '/resources/pug');
|
|||
app.locals.linkbar = config().linkbar;
|
||||
app.locals.times = config().times;
|
||||
app.locals.time = time;
|
||||
app.locals.motd = require('./motd.json');
|
||||
|
||||
//Set up all static directories for getting resources.
|
||||
app.use('/css', less(__dirname + '/resources/less'));
|
||||
|
|
@ -43,9 +44,7 @@ app.use('/other', express.static(__dirname + '/resources/other'));
|
|||
app.use('/images', express.static(__dirname + '/resources/images'));
|
||||
|
||||
//Initialising homepage.
|
||||
app.get('/', auth.is, function (req, res) {
|
||||
res.render('homepage', req);
|
||||
});
|
||||
app.get('/', (req, res) => res.render('homepage', req));
|
||||
|
||||
//Initialize redirector when information is posted to the root of the website.
|
||||
app.post('/', redirecter);
|
||||
|
|
@ -53,12 +52,12 @@ app.post('/', redirecter);
|
|||
//Initialising behavior for searching.
|
||||
app.param('search', lookup.get);
|
||||
|
||||
app.get('/rooster/:search', [auth.is, schedule.get, (req, res) => res.render('schedule', req)]);
|
||||
app.get('/rooster/:search', [schedule.get, (req, res) => res.render('schedule', req)]);
|
||||
|
||||
//Initialising behavior for searching through lists.
|
||||
app.param('list', lookup.list);
|
||||
|
||||
app.get('/klassenlijst/:list',[auth.is, (req, res) => res.render('list', req)]);
|
||||
app.get('/klassenlijst/:list', (req, res) => res.render('list', req));
|
||||
|
||||
//Initialising login page frontend.
|
||||
app.get('/login', (req, res) => res.render('login', req));
|
||||
|
|
@ -68,7 +67,7 @@ app.post('/login', auth.login);
|
|||
app.get('/logout', auth.logout);
|
||||
|
||||
//Intialising API handler.
|
||||
app.get('/api/:api', function (req, res, next) { next(); });
|
||||
app.get('/api/:api', (req, res, next) => next());
|
||||
app.param('api', api);
|
||||
|
||||
//Initialize the server on configured web port.
|
||||
|
|
|
|||
Loading…
Reference in a new issue