Skip to content

Commit

Permalink
Add ranking numbers to the contributors tables
Browse files Browse the repository at this point in the history
Big thanks to @peregrineshahin who created the coding for this idea.
  • Loading branch information
FauziAkram authored and ppigazzini committed Feb 25, 2024
1 parent 1cb4ec9 commit 6577f97
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ David Zar
dubslow
Fabian Fichter (ianfab)
Fanael Linithien (Fanael)
Fauzi Akram Dabat (FauziAkram)
FieryDragonLord
Gabe (MrBrain295)
Giacomo Lorenzetti (G-Lorenz)
Expand Down
8 changes: 7 additions & 1 deletion server/fishtest/static/js/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,13 @@ function handleSortingTables() {
(this.asc = !this.asc),
),
)
.forEach((tr) => body.append(tr));
.forEach((tr, index) => {
const rankData = tr.querySelector("td.rank");
if (rankData) {
rankData.textContent = index + 1;
}
body.append(tr);
});
}
});
}
Expand Down
4 changes: 3 additions & 1 deletion server/fishtest/templates/contributors.mak
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
<table id="contributors_table" class="table table-striped table-sm">
<thead class="sticky-top">
<tr>
<th></th>
<th>Username</th>
<th class="text-end">Last active</th>
<th class="text-end">Games/Hour</th>
Expand All @@ -126,8 +127,9 @@
</tr>
</thead>
<tbody>
% for user in users:
% for index, user in enumerate(users):
<tr>
<td class="rank">${index + 1}</td>
<td>
% if approver:
<a href="/user/${user['username']}">
Expand Down

0 comments on commit 6577f97

Please sign in to comment.