diff options
author | Noah Loomans <noahloomans@gmail.com> | 2018-03-20 22:35:18 +0100 |
---|---|---|
committer | Noah Loomans <noahloomans@gmail.com> | 2018-03-20 22:35:18 +0100 |
commit | 29f7292f84d456a49dd8e2dcd93ab2395470aef0 (patch) | |
tree | b78c0ca29a1c53d5c6e5c8d1a9d45e27b9c2a941 /src | |
parent | 28fc88aee2bb43735bb76b10f111b411ce66e1e4 (diff) |
Move from jade to handlebars
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/error.handlebars | 34 | ||||
-rw-r--r-- | src/client/views/error.jade | 24 | ||||
-rw-r--r-- | src/client/views/index.handlebars | 39 | ||||
-rw-r--r-- | src/client/views/index.jade | 37 | ||||
-rw-r--r-- | src/client/views/layout.jade | 43 | ||||
-rw-r--r-- | src/client/views/partials/head.handlebars | 30 | ||||
-rw-r--r-- | src/client/views/redirect.handlebars | 69 | ||||
-rw-r--r-- | src/client/views/redirect.jade | 65 | ||||
-rw-r--r-- | src/server/app.js | 6 |
9 files changed, 177 insertions, 170 deletions
diff --git a/src/client/views/error.handlebars b/src/client/views/error.handlebars new file mode 100644 index 0000000..9e45829 --- /dev/null +++ b/src/client/views/error.handlebars @@ -0,0 +1,34 @@ +{{!-- + Copyright (C) 2018 Noah Loomans + + This file is part of rooster.hetmml.nl. + + rooster.hetmml.nl is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + rooster.hetmml.nl is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with rooster.hetmml.nl. If not, see <http://www.gnu.org/licenses/>. + +--}} +<!DOCTYPE html> +<html lang="nl"> +<head> + {{> head }} + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <meta http-equiv="X-UA-Compatible" content="ie=edge"> + <title>Metis Rooster - Error</title> +</head> +<body> + <h1>{{ message }}</h1> + <h2>{{ error.status }}</h2> + <pre>{{ error.stack }}</pre> +</body> +</html> diff --git a/src/client/views/error.jade b/src/client/views/error.jade deleted file mode 100644 index 5f66d07..0000000 --- a/src/client/views/error.jade +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2018 Noah Loomans -// -// This file is part of rooster.hetmml.nl. -// -// rooster.hetmml.nl is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// rooster.hetmml.nl is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with rooster.hetmml.nl. If not, see <http://www.gnu.org/licenses/>. -// - -extends layout - -block content - h1= message - h2= error.status - pre #{error.stack} diff --git a/src/client/views/index.handlebars b/src/client/views/index.handlebars new file mode 100644 index 0000000..be6a075 --- /dev/null +++ b/src/client/views/index.handlebars @@ -0,0 +1,39 @@ +{{!-- + Copyright (C) 2018 Noah Loomans + + This file is part of rooster.hetmml.nl. + + rooster.hetmml.nl is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + rooster.hetmml.nl is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with rooster.hetmml.nl. If not, see <http://www.gnu.org/licenses/>. + +--}} +<!DOCTYPE html> +<html lang="nl"> +<head> + {{> head }} + <title>Metis Rooster</title> + <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> + <link rel="stylesheet" href="https://unpkg.com/material-components-web@latest/dist/material-components-web.min.css"> + <link rel="stylesheet" href="/bundle.css"> +</head> +<body> + <div id="root"></div> + <script> + {{{ flagsStr }}} + {{{ usersStr }}} + {{{ dailyScheduleWeeksStr }}} + {{{ basisScheduleWeeksStr }}} + </script> + <script src="/bundle.js"></script> +</body> +</html> diff --git a/src/client/views/index.jade b/src/client/views/index.jade deleted file mode 100644 index 1141624..0000000 --- a/src/client/views/index.jade +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (C) 2018 Noah Loomans -// -// This file is part of rooster.hetmml.nl. -// -// rooster.hetmml.nl is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// rooster.hetmml.nl is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with rooster.hetmml.nl. If not, see <http://www.gnu.org/licenses/>. -// - -extends layout - -block head - link(rel='stylesheet', - href='https://fonts.googleapis.com/icon?family=Material+Icons') - link(rel='stylesheet', - href='https://unpkg.com/material-components-web@latest/dist/material-components-web.min.css') - link(rel='stylesheet', href='/bundle.css') - -block content - #root - -block scripts - script. - !{flagsStr} - !{usersStr} - !{dailyScheduleWeeksStr} - !{basisScheduleWeeksStr} - script(src='/bundle.js') diff --git a/src/client/views/layout.jade b/src/client/views/layout.jade deleted file mode 100644 index 8894fa4..0000000 --- a/src/client/views/layout.jade +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (C) 2018 Noah Loomans -// -// This file is part of rooster.hetmml.nl. -// -// rooster.hetmml.nl is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// rooster.hetmml.nl is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with rooster.hetmml.nl. If not, see <http://www.gnu.org/licenses/>. -// - -block variables - - var bodyStyle = ''; - -doctype html -html(lang='nl') - head - block head_top - if isBeta - title BETA Metis Rooster - else - title Metis Rooster - meta(name='theme-color',content='#F44336') - meta(name='viewport', content='width=device-width, initial-scale=1') - link(href='https://fonts.googleapis.com/css?family=Roboto', rel='stylesheet') - link(rel='manifest', href='/manifest.webmanifest') - link(rel="apple-touch-icon", sizes="120x120", href="/apple-touch-icon.png") - link(rel="icon", type="image/png", href="/favicon-32x32.png", sizes="32x32") - link(rel="icon", type="image/png", href="/favicon-16x16.png", sizes="16x16") - link(rel="mask-icon", href="/safari-pinned-tab.svg", color="#f44336") - block head - body(style=bodyStyle) - block content - script. - (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');ga('create', 'UA-83684754-1', 'auto');ga('send', 'pageview'); - block scripts diff --git a/src/client/views/partials/head.handlebars b/src/client/views/partials/head.handlebars new file mode 100644 index 0000000..9801a95 --- /dev/null +++ b/src/client/views/partials/head.handlebars @@ -0,0 +1,30 @@ +{{!-- + Copyright (C) 2018 Noah Loomans + + This file is part of rooster.hetmml.nl. + + rooster.hetmml.nl is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + rooster.hetmml.nl is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with rooster.hetmml.nl. If not, see <http://www.gnu.org/licenses/>. + +--}} +<meta charset="UTF-8"> +<meta name="viewport" content="width=device-width initial-scale=1.0"> +<meta http-equiv="X-UA-Compatible" content="ie=edge"> +<meta name="theme-color" content="#F44336"> +<meta name="viewport" content="width=device-width initial-scale=1"> +<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet"> +<link rel="manifest" href="/manifest.webmanifest"> +<link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon.png"> +<link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32"> +<link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16"> +<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#f44336"> diff --git a/src/client/views/redirect.handlebars b/src/client/views/redirect.handlebars new file mode 100644 index 0000000..cf2a6ee --- /dev/null +++ b/src/client/views/redirect.handlebars @@ -0,0 +1,69 @@ +{{!-- + Copyright (C) 2018 Noah Loomans + + This file is part of rooster.hetmml.nl. + + rooster.hetmml.nl is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + rooster.hetmml.nl is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with rooster.hetmml.nl. If not, see <http://www.gnu.org/licenses/>. + +--}} +<!DOCTYPE html> +<html lang="nl"> +<head> + {{> head }} + <title>Metis Rooster - Error</title> + <style> + body { + font-family: "Roboto", sans-serif; + text-align: center; + margin: 32px; + } + + .content { + max-width: 600px; + margin: 0 auto; + } + + h1 { + color: #212121; + margin-bottom: 32px; + } + + h2 { + color: #727272; + margin-bottom: 64px; + } + + a, a:visited { + margin: 8px; + padding: 8px 16px; + background-color: #c84127; + color: white; + text-decoration: none; + font-weight: bold; + border-radius: 3px; + } + + a:hover, a:focus, a:active { + background-color: #e45a3f; + } + </style> +</head> +<body> + <img src="/icons/mml-logo.png" alt=""> + <h1>Er is iets mis gegaan tijdens het ophalen van de benodigde informatie</h1> + <h2>Je kunt proberen door te gaan naar het oude rooster of Magister</h2> + <a href="http://www.meetingpointmco.nl/Roosters-AL/doc/">Oud rooster</a> + <a href="http://msa.magister.net/">Magister</a> +</body> +</html> diff --git a/src/client/views/redirect.jade b/src/client/views/redirect.jade deleted file mode 100644 index 832589b..0000000 --- a/src/client/views/redirect.jade +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (C) 2018 Noah Loomans -// -// This file is part of rooster.hetmml.nl. -// -// rooster.hetmml.nl is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// rooster.hetmml.nl is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with rooster.hetmml.nl. If not, see <http://www.gnu.org/licenses/>. -// - -extends layout - -block head - style. - body { - font-family: 'Roboto', sans-serif; - text-align: center; - margin: 32px; - } - - .content { - max-width: 600px; - margin: 0 auto; - } - - h1 { - color: #212121; - margin-bottom: 32px; - } - - h2 { - color: #727272; - margin-bottom: 64px; - } - - a, a:visited { - margin: 8px; - padding: 8px 16px; - background-color: #c84127; - color: white; - text-decoration: none; - font-weight: bold; - border-radius: 3px; - } - - a:hover, a:focus, a:active { - background-color: #e45a3f; - } - -block content - .content - script document.body.style.opacity = 1 - img(src='/icons/mml-logo.png') - h1 Er is iets mis gegaan tijdens het ophalen van de benodigde informatie - h2 Je kunt proberen door te gaan naar het oude rooster of Magister - a(href='http://www.meetingpointmco.nl/Roosters-AL/doc/') Oud rooster - a(href='http://msa.magister.net/') Magister diff --git a/src/server/app.js b/src/server/app.js index 7b03128..7e8d9e9 100644 --- a/src/server/app.js +++ b/src/server/app.js @@ -23,6 +23,7 @@ const path = require('path'); const logger = require('morgan'); const bodyParser = require('body-parser'); const compression = require('compression'); +const handlebars = require('express-handlebars'); const index = require('./routes/index'); const getSchedule = require('./routes/getSchedule'); @@ -32,8 +33,11 @@ const app = express(); app.use(compression()); // view engine setup +app.engine('handlebars', handlebars({ + partialsDir: path.join(__dirname, '../client/views/partials'), +})); app.set('views', path.join(__dirname, '../client/views')); -app.set('view engine', 'jade'); +app.set('view engine', 'handlebars'); app.use(logger('dev')); app.use(bodyParser.urlencoded({ extended: false })); |