diff --git a/public/scripts/submit.js b/public/scripts/submit.js deleted file mode 100644 index 8c3cf81..0000000 --- a/public/scripts/submit.js +++ /dev/null @@ -1,113 +0,0 @@ -import * as Data from "./data.js"; - - -const sportDropdown = document.getElementById('sport-dropdown'); -const seasonDropdown = document.getElementById('year-dropdown'); -const genderDropdown = document.getElementById('gender-dropdown'); -const divisionDropdown = document.getElementById('division-dropdown'); -const team1Dropdown = document.getElementById('team1-dropdown'); -const team2Dropdown = document.getElementById('team2-dropdown'); - - - - - -async function listSeasons() { - seasonDropdown.innerHTML = ""; - - const seasonsList = await Data.getSeasons(); - - seasonsList.forEach(season => { - const option = document.createElement('option'); - option.text = (season.year - 1) + "-" + season.year; - option.value = season.id; - seasonDropdown.appendChild(option); - }); -} -listSeasons(); - -async function listSports() { - sportDropdown.innerHTML = ""; - - const sportsList = await Data.getSports(); - - sportsList.forEach(sport => { - const option = document.createElement('option'); - option.text = sport.name; - option.value = sport.id; - sportDropdown.appendChild(option); - }); - - listGenders(); - listTeams(); -} -listSports(); - -async function listGenders() { - genderDropdown.innerHTML = ""; - - const selectedSportID = sportDropdown.value; - const gendersList = await Data.getGenders(selectedSportID); - - if(selectedSportID) { - gendersList.forEach(gender => { - const option = document.createElement('option'); - option.text = (gender.name == "female") ? "Female" : (gender.name == "male") ? "Male" : ""; - option.value = gender.name; - genderDropdown.appendChild(option); - }); - } - - listDivisions(); -} - -async function listDivisions() { - divisionDropdown.innerHTML = ""; - - const selectedSportID = sportDropdown.value; - const selectedGender = genderDropdown.value; - - if(selectedGender) { - const divisionsList = await Data.getDivisions(selectedSportID, selectedGender); - - divisionsList.forEach(division => { - const option = document.createElement('option'); - option.text = division.name; - option.value = division.id; - divisionDropdown.appendChild(option); - }); - } -} - -async function listTeams() { - team1Dropdown.innerHTML = ""; - team2Dropdown.innerHTML = ""; - - const selectedSportID = sportDropdown.value; - - if(selectedSportID) { - const teamsList = await Data.getTeams(selectedSportID); - - teamsList.forEach(team => { - const optionT1 = document.createElement('option'); - optionT1.text = team.name; - optionT1.value = team.id; - team1Dropdown.appendChild(optionT1); - - const optionT2 = document.createElement('option'); - optionT2.text = team.name; - optionT2.value = team.id; - team2Dropdown.appendChild(optionT2); - }); - } -} - - - - - -sportDropdown.onchange = (() => { - listGenders(); - listTeams(); -}); -genderDropdown.onchange = listDivisions; \ No newline at end of file diff --git a/routes/admin.js b/routes/admin.js deleted file mode 100644 index 9e9cfc9..0000000 --- a/routes/admin.js +++ /dev/null @@ -1,24 +0,0 @@ -var express = require('express'); -var router = express.Router(); -const passport = require('passport'); -const app = require('../app'); -const accounts = require('./../database/accounts/accounts'); - - -function adminLoggedIn(req, res, next) { - if (req.user && req.user[2]) { - next(); - } - else { - req.flash('error', 'An admin account is required to access this page.'); - res.redirect('/auth/login'); - } - } - -router.get('/', adminLoggedIn, (req, res, next) => { - res.render -}); - - - -module.exports = router; \ No newline at end of file diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 4f2ac60..0000000 --- a/test/test.js +++ /dev/null @@ -1,10 +0,0 @@ -const request = require('supertest'); -const app = require('../app'); - -describe('App', function() { - it('has the default page', function(done) { - request(app) - .get('/') - .expect(/Welcome to Express/, done); - }); -}); diff --git a/views/manage/layout.pug b/views/manage/layout.pug deleted file mode 100644 index e4f85eb..0000000 --- a/views/manage/layout.pug +++ /dev/null @@ -1,10 +0,0 @@ -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