diff --git a/public/scripts/manage/season.js b/public/scripts/manage/season.js new file mode 100644 index 0000000..e69de29 diff --git a/routes/manage.js b/routes/manage.js index 454c3c9..72d0784 100644 --- a/routes/manage.js +++ b/routes/manage.js @@ -2,6 +2,7 @@ var express = require('express'); var router = express.Router(); var genders = require('../database/scores/genders'); var games = require('../database/scores/games'); +var seasons = require('../database/scores/seasons'); router.get('/', function(req, res, next) { @@ -27,4 +28,15 @@ router.post('/submitgame', function(req, res, next) { .then(res.send("SUCCESS")); }); +router.get('/addseason', function(req, res, next) { + res.render('manage/addseason', { title: 'Add season', currentYear : (new Date()).getFullYear() }); +}); + +router.post('/submitseason', function(req, res, next) { + const year = req.body['year']; + + seasons.add(year) + .then(res.send("SUCCESS")); +}); + module.exports = router; diff --git a/views/manage/addseason.pug b/views/manage/addseason.pug new file mode 100644 index 0000000..e82937c --- /dev/null +++ b/views/manage/addseason.pug @@ -0,0 +1,19 @@ +extends layout + +block stylesheets + link(rel='stylesheet', href='/stylesheets/submit.css') + link(rel='stylesheet', href='/stylesheets/form.css') + +block content + div#mobile-view + h1 Add Season + form(action='./submitseason', method='POST') + span(class='form-section') + label Ending year + span(class='form-section-input') + input(type="number", name="year", value=currentYear) + span(class='form-section') + button#submit-button(type="submit") Submit + +block scripts + script(src='/scripts/season.js' type="module") \ No newline at end of file