Remove unnecessary files
parent
5c783880a7
commit
dd0a9c4316
|
@ -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;
|
|
@ -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;
|
10
test/test.js
10
test/test.js
|
@ -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);
|
||||
});
|
||||
});
|
|
@ -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
|
Reference in New Issue