Add page for adding sports
parent
31575212ad
commit
f95015095d
|
@ -85,7 +85,7 @@ CATEGORIES.push(new Category(
|
|||
row.appendChild(spacerCell);
|
||||
},
|
||||
async function addSport() {
|
||||
//
|
||||
window.location.href = "manage/addsport";
|
||||
},
|
||||
async function editSport() {
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ var router = express.Router();
|
|||
var genders = require('../database/scores/genders');
|
||||
var games = require('../database/scores/games');
|
||||
var seasons = require('../database/scores/seasons');
|
||||
var sports = require('../database/scores/sports');
|
||||
|
||||
|
||||
router.get('/', function(req, res, next) {
|
||||
|
@ -39,4 +40,15 @@ router.post('/submitseason', function(req, res, next) {
|
|||
.then(res.send("SUCCESS"));
|
||||
});
|
||||
|
||||
router.get('/addsport', function(req, res, next) {
|
||||
res.render('manage/addsport', { title: 'Add sport' });
|
||||
});
|
||||
|
||||
router.post('/submitsport', function(req, res, next) {
|
||||
const name = req.body['name'];
|
||||
|
||||
sports.add(name)
|
||||
.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 Sport
|
||||
form(action='./submitsport', method='POST')
|
||||
span(class='form-section')
|
||||
label Sport name
|
||||
span(class='form-section-input')
|
||||
input(type="text", name="name")
|
||||
span(class='form-section')
|
||||
button#submit-button(type="submit") Submit
|
||||
|
||||
block scripts
|
||||
script(src='/scripts/sport.js' type="module")
|
Reference in New Issue