Skip to content

Commit

Permalink
Ranking: Replace team flags with usernames
Browse files Browse the repository at this point in the history
  • Loading branch information
fushar committed Aug 31, 2022
1 parent 738a826 commit a9742bd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 2 additions & 0 deletions cmsranking/static/Ranking.css
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,8 @@ abbr {

#UserDetail_flag {
bottom: 0;
max-width: 100px;
display: none;
}

#UserDetail_face {
Expand Down
9 changes: 4 additions & 5 deletions cmsranking/static/Scoreboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,10 @@ var Scoreboard = new function () {

if (user['team']) {
result += " \
<td class=\"team\"><img src=\"" + Config.get_flag_url(user["team"]) + "\" title=\"" + DataStore.teams[user["team"]]["name"] + "\" /></td>";
<td class=\"team\" title=\"" + DataStore.teams[user["team"]]["name"] + "\">" + user['key'] + "</td>";
} else {
result += " \
<td class=\"team\"></td>";
<td class=\"team\">" + user['key'] + "</td>";
}

var contests = DataStore.contest_list;
Expand Down Expand Up @@ -406,10 +406,9 @@ var Scoreboard = new function () {
$row.children("td.f_name").text(user["f_name"]);
$row.children("td.l_name").text(user["l_name"]);

$row.children(".team").text(user['key']);
if (user["team"]) {
$row.children(".team").html("<img src=\"" + Config.get_flag_url(user["team"]) + "\" title=\"" + DataStore.teams[user["team"]]["name"] + "\" />");
} else {
$row.children(".team").text("");
$row.children(".team").attr("title", DataStore.teams[user["team"]]["name"]);
}
};

Expand Down
4 changes: 2 additions & 2 deletions cmsranking/static/TeamSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ var TeamSearch = new function () {
<div class=\"item\" data-team=\"" + t_id + "\"> \
<label> \
<input type=\"checkbox\"/> \
<img class=\"flag\" src=\"" + Config.get_flag_url(t_id) + "\" /> " + team['name'] + " \
<span>" + t_id +": " + team['name'] + " \
</label> \
</div>";
}
Expand Down Expand Up @@ -186,7 +186,7 @@ var TeamSearch = new function () {
// (We would need another query to get the complementary set).
for (var t_id in DataStore.teams) {
var team = DataStore.teams[t_id];
if (team["name"].toLowerCase().indexOf(search_text.toLowerCase()) == -1) {
if (team["name"].toLowerCase().indexOf(search_text.toLowerCase()) == -1 && t_id.toLowerCase().indexOf(search_text.toLowerCase()) == -1) {
$("div.item[data-team=" + t_id + "]", self.body).addClass("hidden");
} else {
$("div.item[data-team=" + t_id + "]", self.body).removeClass("hidden");
Expand Down

0 comments on commit a9742bd

Please sign in to comment.