Move game submit page from /submit to /manage/addgame
parent
e257e97320
commit
9f2572336f
|
@ -52,9 +52,6 @@ CATEGORIES.push(new Category(
|
||||||
async function addSeason() {
|
async function addSeason() {
|
||||||
//
|
//
|
||||||
},
|
},
|
||||||
async function submitSeason() {
|
|
||||||
//
|
|
||||||
},
|
|
||||||
async function editSeason() {
|
async function editSeason() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -89,9 +86,6 @@ CATEGORIES.push(new Category(
|
||||||
async function addSport() {
|
async function addSport() {
|
||||||
//
|
//
|
||||||
},
|
},
|
||||||
async function submitSport() {
|
|
||||||
//
|
|
||||||
},
|
|
||||||
async function editSport() {
|
async function editSport() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -143,9 +137,6 @@ CATEGORIES.push(new Category(
|
||||||
async function addSeason() {
|
async function addSeason() {
|
||||||
//
|
//
|
||||||
},
|
},
|
||||||
async function submitSeason() {
|
|
||||||
//
|
|
||||||
},
|
|
||||||
async function editSeason() {
|
async function editSeason() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -189,9 +180,6 @@ CATEGORIES.push(new Category(
|
||||||
async function addSeason() {
|
async function addSeason() {
|
||||||
//
|
//
|
||||||
},
|
},
|
||||||
async function submitSeason() {
|
|
||||||
//
|
|
||||||
},
|
|
||||||
async function editSeason() {
|
async function editSeason() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -278,10 +266,7 @@ CATEGORIES.push(new Category(
|
||||||
dateCell.appendChild(dateSpan);
|
dateCell.appendChild(dateSpan);
|
||||||
row.appendChild(dateCell);
|
row.appendChild(dateCell);
|
||||||
},
|
},
|
||||||
async function addSeason() {
|
async function addGame() {
|
||||||
//
|
|
||||||
},
|
|
||||||
async function submitSeason() {
|
|
||||||
//
|
//
|
||||||
},
|
},
|
||||||
async function editSeason() {
|
async function editSeason() {
|
||||||
|
|
|
@ -1,9 +1,30 @@
|
||||||
var express = require('express');
|
var express = require('express');
|
||||||
var router = express.Router();
|
var router = express.Router();
|
||||||
|
var genders = require('../database/scores/genders');
|
||||||
|
var games = require('../database/scores/games');
|
||||||
|
|
||||||
|
|
||||||
/* GET manage page. */
|
|
||||||
router.get('/', function(req, res, next) {
|
router.get('/', function(req, res, next) {
|
||||||
res.render('manage', { title: 'Score Management' });
|
res.render('manage', { title: 'Score Management' });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
router.get('/addgame', function(req, res, next) {
|
||||||
|
res.render('manage/addgame', { title: 'Submit Score' });
|
||||||
|
});
|
||||||
|
|
||||||
|
router.post('/submitgame', function(req, res, next) {
|
||||||
|
const seasonID = req.body['year'];
|
||||||
|
const sportID = req.body['sport'];
|
||||||
|
const gender = (req.body['gender'] == "female") ? genders.FEMALE : genders.MALE;
|
||||||
|
const divisionID = req.body['division'];
|
||||||
|
const date = req.body['date'];
|
||||||
|
const team1ID = req.body['team1'];
|
||||||
|
const team1Score = req.body['team1-score'];
|
||||||
|
const team2ID = req.body['team2'];
|
||||||
|
const team2Score = req.body['team2-score'];
|
||||||
|
|
||||||
|
games.add(divisionID, seasonID, date, team1ID, team2ID, team1Score, team2Score)
|
||||||
|
.then(res.send("SUCCESS"));
|
||||||
|
});
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
var express = require('express');
|
|
||||||
var router = express.Router();
|
|
||||||
var genders = require('../database/scores/genders');
|
|
||||||
var games = require('../database/scores/games');
|
|
||||||
|
|
||||||
/* GET submit page. */
|
|
||||||
router.get('/', function(req, res, next) {
|
|
||||||
res.render('submit', { title: 'Submit Score' });
|
|
||||||
});
|
|
||||||
|
|
||||||
/* POST submit page. */
|
|
||||||
router.post('/', function(req, res, next) {
|
|
||||||
const seasonID = req.body['year'];
|
|
||||||
const sportID = req.body['sport'];
|
|
||||||
const gender = (req.body['gender'] == "female") ? genders.FEMALE : genders.MALE;
|
|
||||||
const divisionID = req.body['division'];
|
|
||||||
const date = moment(req.body['date']);
|
|
||||||
const team1ID = req.body['team1'];
|
|
||||||
const team1Score = req.body['team1-score'];
|
|
||||||
const team2ID = req.body['team2'];
|
|
||||||
const team2Score = req.body['team2-score'];
|
|
||||||
|
|
||||||
games.add(divisionID, seasonID, date, team1ID, team2ID, team1Score, team2Score)
|
|
||||||
.then(res.send("SUCCESS"));
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = router;
|
|
|
@ -7,7 +7,7 @@ block stylesheets
|
||||||
block content
|
block content
|
||||||
div#mobile-view
|
div#mobile-view
|
||||||
h1 Submit Score
|
h1 Submit Score
|
||||||
form(action='/submit', method='POST')
|
form(action='./submitgame', method='POST')
|
||||||
span(class='form-section')
|
span(class='form-section')
|
||||||
label Year
|
label Year
|
||||||
span(class='form-section-input')
|
span(class='form-section-input')
|
|
@ -0,0 +1,10 @@
|
||||||
|
doctype html
|
||||||
|
html
|
||||||
|
head
|
||||||
|
title= title
|
||||||
|
meta(name='viewport', content='width=device-width, initial-scale=1')
|
||||||
|
link(rel='stylesheet', href='/stylesheets/style.css')
|
||||||
|
block stylesheets
|
||||||
|
body
|
||||||
|
block content
|
||||||
|
block scripts
|
Reference in New Issue