Create page to add season
parent
7c5c059e09
commit
4133758bba
|
@ -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;
|
||||
|
|
|
@ -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")
|
Reference in New Issue