Clicklable links added to top scorers table

This commit is contained in:
Lucas Patenaude
2024-04-14 22:11:53 -06:00
parent 17704288c7
commit 74fc302530
3 changed files with 4 additions and 4 deletions

View File

@@ -24,7 +24,7 @@ const fetchLeagueScorerData = async (req, res, next) => {
player_name: player.player.name, player_name: player.player.name,
}, },
team: { team: {
team_id: player.player.id, team_id: player.team.id,
team_name: player.team.name, team_name: player.team.name,
team_crest: player.team.crest, team_crest: player.team.crest,
}, },

View File

@@ -1,5 +1,5 @@
// Add click event listener to club logos // Add click event listener to club logos
document.querySelectorAll('#table-club-logo, #club-name').forEach(element => { document.querySelectorAll('#table-club-logo, #club-name, #top-scorers-logo').forEach(element => {
element.addEventListener('click', (event) => { element.addEventListener('click', (event) => {
// Get the club ID from the clicked club logo's clubID attribute // Get the club ID from the clicked club logo's clubID attribute
const clubId = element.getAttribute('clubID'); const clubId = element.getAttribute('clubID');

View File

@@ -38,7 +38,7 @@
{{#each league.standings}} {{#each league.standings}}
<tr> <tr>
<td>{{table.league_position}}</td> <td>{{table.league_position}}</td>
<td id="club-logo-column"><img src="{{table.team_crest}}" alt="{{table.team_name}} Crest" id="table-club-logo" clubID="{{table.team_id}}"></td> <td id="club-logo-column"><img id="table-club-logo" clubID="{{table.team_id}}" src="{{table.team_crest}}" alt="{{table.team_name}} Crest"></td>
<td><span id="club-name-column" clubID="{{table.team_id}}">{{table.team_name}}</span></td> <td><span id="club-name-column" clubID="{{table.team_id}}">{{table.team_name}}</span></td>
<td>{{games_played}}</td> <td>{{games_played}}</td>
<td>{{wins}}</td> <td>{{wins}}</td>
@@ -74,7 +74,7 @@
{{#each topScorers.scorers}} {{#each topScorers.scorers}}
<tr id="top-scorers-row"> <tr id="top-scorers-row">
<td id="goals-column">{{goals}}</td> <td id="goals-column">{{goals}}</td>
<td><img id="top-scorers-logo" src="{{team.team_crest}}" alt="{{table.team_name}} Crest"></td> <td><img id="top-scorers-logo" clubID="{{team.team_id}}" src="{{team.team_crest}}" alt="{{table.team_name}} Crest"></img></td>
<td id="player-name-column">{{player.player_name}}</td> <td id="player-name-column">{{player.player_name}}</td>
<td id="club-name-column">{{team.team_name}}</td> <td id="club-name-column">{{team.team_name}}</td>
<td>{{games_played}}</td> <td>{{games_played}}</td>