Allow "Add new..." button to redirect to webpages per category
This commit is contained in:
		
							parent
							
								
									4133758bba
								
							
						
					
					
						commit
						31575212ad
					
				
					 2 changed files with 6 additions and 4 deletions
				
			
		| 
						 | 
					@ -2,6 +2,7 @@ import * as Data from "./data.js";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const categoryDropdown = document.getElementById('category-dropdown');
 | 
					const categoryDropdown = document.getElementById('category-dropdown');
 | 
				
			||||||
const itemsListTable = document.getElementById('items-list');
 | 
					const itemsListTable = document.getElementById('items-list');
 | 
				
			||||||
 | 
					const addNewButton = document.getElementById('add-new-button');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function getGenderLetter(genderName) {
 | 
					function getGenderLetter(genderName) {
 | 
				
			||||||
| 
						 | 
					@ -50,7 +51,7 @@ CATEGORIES.push(new Category(
 | 
				
			||||||
        row.appendChild(spacerCell);
 | 
					        row.appendChild(spacerCell);
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    async function addSeason() {
 | 
					    async function addSeason() {
 | 
				
			||||||
        //
 | 
					        window.location.href = "manage/addseason";
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    async function editSeason() {
 | 
					    async function editSeason() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -267,7 +268,7 @@ CATEGORIES.push(new Category(
 | 
				
			||||||
        row.appendChild(dateCell);
 | 
					        row.appendChild(dateCell);
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    async function addGame() {
 | 
					    async function addGame() {
 | 
				
			||||||
        //
 | 
					        window.location.href = "manage/addgame";
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    async function editSeason() {
 | 
					    async function editSeason() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -313,4 +314,5 @@ listItems(CATEGORIES[categoryDropdown.selectedIndex]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
categoryDropdown.onchange = () => {
 | 
					categoryDropdown.onchange = () => {
 | 
				
			||||||
    listItems(CATEGORIES[categoryDropdown.selectedIndex]);
 | 
					    listItems(CATEGORIES[categoryDropdown.selectedIndex]);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					addNewButton.addEventListener('click', () => CATEGORIES[categoryDropdown.selectedIndex].addItem());
 | 
				
			||||||
| 
						 | 
					@ -20,7 +20,7 @@ block content
 | 
				
			||||||
    div 
 | 
					    div 
 | 
				
			||||||
        h2#table-header
 | 
					        h2#table-header
 | 
				
			||||||
        table#items-list
 | 
					        table#items-list
 | 
				
			||||||
        button Add new...
 | 
					        button#add-new-button Add new...
 | 
				
			||||||
 | 
					
 | 
				
			||||||
block scripts 
 | 
					block scripts 
 | 
				
			||||||
  script(src='/scripts/manage.js' type="module")
 | 
					  script(src='/scripts/manage.js' type="module")
 | 
				
			||||||
		Reference in a new issue