diff --git a/ProjectSourceCode/src/resources/routes/club-pages/redirect-to-club-url.js b/ProjectSourceCode/src/resources/routes/club-pages/redirect-to-club-url.js index f30fccf..6817f1c 100644 --- a/ProjectSourceCode/src/resources/routes/club-pages/redirect-to-club-url.js +++ b/ProjectSourceCode/src/resources/routes/club-pages/redirect-to-club-url.js @@ -1,24 +1,17 @@ // Add click event listener to club logos -document.querySelectorAll('.club-logo, #club-name').forEach(element => { +document.querySelectorAll('.club-logo').forEach(element => { element.addEventListener('click', (event) => { - let clubId; - if (element.dataset.teamId) { - // If it's a logo, get the club ID from the logo's dataset - clubId = element.dataset.teamId; - } else { - // If it's a team name, get the club ID from the parent row's dataset - clubId = event.target.closest('tr').dataset.teamId; - } + // Get the club ID from the clicked club logo's clubID attribute + const clubId = element.getAttribute('clubID'); redirectToClubPage(clubId); }); }); - -// Function to redirect to the league page +// Function to redirect to the club page function redirectToClubPage(clubID) { - // Append the league name to the URL + // Append the club ID to the URL var url = "/club/" + clubID; - // Redirect to the league page + // Redirect to the club page window.location.href = url; } diff --git a/ProjectSourceCode/src/views/pages/leagues-page.hbs b/ProjectSourceCode/src/views/pages/leagues-page.hbs index 5e71c45..fa49e48 100644 --- a/ProjectSourceCode/src/views/pages/leagues-page.hbs +++ b/ProjectSourceCode/src/views/pages/leagues-page.hbs @@ -32,7 +32,7 @@ {{#each league.standings}} {{table.league_position}} - +

{{table.team_name}}

{{games_played}} {{wins}}