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 | |
parent | 28fc88aee2bb43735bb76b10f111b411ce66e1e4 (diff) |
Move from jade to handlebars
-rw-r--r-- | package.json | 1 | ||||
-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 | ||||
-rw-r--r-- | yarn.lock | 29 |
11 files changed, 204 insertions, 173 deletions
diff --git a/package.json b/package.json index 7d506a1..9182059 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "encoding": "^0.1.12", "eslint": "^4.14.0", "express": "^4.13.4", + "express-handlebars": "^3.0.0", "extract-text-webpack-plugin": "^3.0.2", "flexibility": "^2.0.1", "fuzzy-search": "^2.0.1", 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 })); @@ -2905,6 +2905,16 @@ expect@^21.2.1: jest-message-util "^21.2.1" jest-regex-util "^21.2.0" +express-handlebars@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/express-handlebars/-/express-handlebars-3.0.0.tgz#80a070bb819b09e4af2ca6d0780f75ce05e75c2f" + dependencies: + glob "^6.0.4" + graceful-fs "^4.1.2" + handlebars "^4.0.5" + object.assign "^4.0.3" + promise "^7.0.0" + express@^4.13.4: version "4.15.4" resolved "https://registry.yarnpkg.com/express/-/express-4.15.4.tgz#032e2253489cf8fce02666beca3d11ed7a2daed1" @@ -3524,7 +3534,7 @@ handle-thing@^1.2.5: version "1.2.5" resolved "https://registry.yarnpkg.com/handle-thing/-/handle-thing-1.2.5.tgz#fd7aad726bf1a5fd16dfc29b2f7a6601d27139c4" -handlebars@^4.0.3: +handlebars@^4.0.3, handlebars@^4.0.5: version "4.0.11" resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.11.tgz#630a35dfe0294bc281edae6ffc5d329fc7982dcc" dependencies: @@ -3585,6 +3595,10 @@ has-gulplog@^0.1.0: dependencies: sparkles "^1.0.0" +has-symbols@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.0.tgz#ba1a8f1af2a0fc39650f5c850367704122063b44" + has-unicode@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" @@ -5406,10 +5420,19 @@ object-assign@^4.0.0, object-assign@^4.0.1, object-assign@^4.1.0, object-assign@ version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" -object-keys@^1.0.8: +object-keys@^1.0.11, object-keys@^1.0.8: version "1.0.11" resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d" +object.assign@^4.0.3: + version "4.1.0" + resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.0.tgz#968bf1100d7956bb3ca086f006f846b3bc4008da" + dependencies: + define-properties "^1.1.2" + function-bind "^1.1.1" + has-symbols "^1.0.0" + object-keys "^1.0.11" + object.defaults@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/object.defaults/-/object.defaults-1.1.0.tgz#3a7f868334b407dea06da16d88d5cd29e435fecf" @@ -6053,7 +6076,7 @@ promise@^6.0.1: dependencies: asap "~1.0.0" -promise@^7.1.1: +promise@^7.0.0, promise@^7.1.1: version "7.3.1" resolved "https://registry.yarnpkg.com/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf" dependencies: |