Skip to content

Commit 378838e

Browse files
authored
RWS: hide "global score" column when only 1 contest, hide teams when no teams exist (#1467)
1 parent bfdc54f commit 378838e

File tree

4 files changed

+25
-5
lines changed

4 files changed

+25
-5
lines changed

cmsranking/static/DataStore.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -914,6 +914,10 @@ var DataStore = new function () {
914914
self.update_network_status(0);
915915
});
916916

917+
self.team_create.add(function() {
918+
$(document.body).removeClass("teams-hidden");
919+
});
920+
917921

918922
////// Sorted contest list
919923

cmsranking/static/Ranking.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,10 @@ abbr {
265265
outline: 0;
266266
}
267267

268+
.teams-hidden #TeamSearch_input {
269+
display: none;
270+
}
271+
268272
#TeamSearch_bg {
269273
display: none;
270274
position: absolute;
@@ -404,6 +408,10 @@ abbr {
404408
width: calc(2em + 20px);
405409
}
406410

411+
.teams-hidden #Scoreboard .team {
412+
display: none;
413+
}
414+
407415
#Scoreboard_head tr {
408416
height: 2.5em;
409417
}

cmsranking/static/Ranking.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<script src="Ranking.js"></script>
3030
<title>Ranking</title>
3131
</head>
32-
<body>
32+
<body class="teams-hidden">
3333
<div id="OuterFrame">
3434
<div id="LogoPanel">
3535
<img src="logo" alt="Logo" />

cmsranking/static/Scoreboard.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,12 @@ var Scoreboard = new function () {
176176
<col class=\"score contest\" data-contest=\"" + c_id + "\" data-sort_key=\"c_" + c_id + "\"/> <col/><col/><col/>";
177177
}
178178

179-
result += " \
179+
self.show_global_score = contests.length > 1;
180+
181+
if(self.show_global_score) {
182+
result += " \
180183
<col class=\"score global\" data-sort_key=\"global\"/> <col/><col/><col/><col/>";
184+
}
181185

182186
return result;
183187
};
@@ -212,9 +216,11 @@ var Scoreboard = new function () {
212216
<th colspan=\"4\" class=\"score contest\" data-contest=\"" + c_id + "\" data-sort_key=\"c_" + c_id + "\"><abbr title=\"" + escapeHTML(contest["name"]) + "\">" + escapeHTML(contest["name"]) + "</abbr></th>";
213217
}
214218

215-
result += " \
219+
if(self.show_global_score) {
220+
result += " \
216221
<th colspan=\"5\" class=\"score global\" data-sort_key=\"global\">Global</th> \
217222
</tr>";
223+
}
218224

219225
return result;
220226
};
@@ -269,10 +275,12 @@ var Scoreboard = new function () {
269275
<td colspan=\"4\" class=\"score contest " + score_class + "\" data-contest=\"" + c_id + "\" data-sort_key=\"c_" + c_id + "\">" + round_to_str(user["c_" + c_id], contest["score_precision"]) + "</td>";
270276
}
271277

272-
var score_class = self.get_score_class(user["global"], DataStore.global_max_score);
273-
result += " \
278+
if(self.show_global_score) {
279+
var score_class = self.get_score_class(user["global"], DataStore.global_max_score);
280+
result += " \
274281
<td colspan=\"5\" class=\"score global " + score_class + "\" data-sort_key=\"global\">" + round_to_str(user["global"], DataStore.global_score_precision) + "</td> \
275282
</tr>";
283+
}
276284

277285
return result;
278286
};

0 commit comments

Comments
 (0)