Skip to content

Commit 59781ae

Browse files
Show mobile scoreboard only for public.
1 parent 9f6a187 commit 59781ae

File tree

1 file changed

+153
-151
lines changed

1 file changed

+153
-151
lines changed

webapp/templates/partials/scoreboard_table.html.twig

Lines changed: 153 additions & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
</style>
2929
{% endif %}
3030
31-
<div class="d-none d-md-block">
31+
{% if public %}<div class="d-none d-md-block">{% endif %}
3232
<table class="scoreboard desktop-scoreboard center {% if jury %}scoreboard_jury{% endif %}">
3333
3434
{# output table column groups (for the styles) #}
@@ -314,174 +314,176 @@
314314
{% include 'partials/scoreboard_summary.html.twig' with {sortOrder: previousSortOrder} %}
315315
</tbody>
316316
</table>
317-
</div>
317+
{% if public %}</div>{% endif %}
318318
319-
<table class="d-md-none scoreboard mobile-scoreboard center {% if jury %}scoreboard_jury{% endif %}">
320-
{# output table column groups (for the styles) #}
321-
<colgroup>
322-
<col id="scorerank-mobile"/>
323-
{% if showFlags %}
324-
<col id="scoreflags-mobile"/>
325-
{% else %}
326-
<col/>
327-
{% endif %}
319+
{% if public %}
320+
<table class="d-md-none scoreboard mobile-scoreboard center {% if jury %}scoreboard_jury{% endif %}">
321+
{# output table column groups (for the styles) #}
322+
<colgroup>
323+
<col id="scorerank-mobile"/>
324+
{% if showFlags %}
325+
<col id="scoreflags-mobile"/>
326+
{% else %}
327+
<col/>
328+
{% endif %}
329+
{% if showAffiliationLogos %}
330+
<col id="scorelogos-mobile"/>
331+
{% endif %}
332+
<col id="scoreteamname-mobile"/>
333+
</colgroup>
334+
<colgroup>
335+
<col id="scoresolv-mobile"/>
336+
</colgroup>
337+
338+
{% set teamColspan = 2 %}
328339
{% if showAffiliationLogos %}
329-
<col id="scorelogos-mobile"/>
340+
{% set teamColspan = teamColspan + 1 %}
330341
{% endif %}
331-
<col id="scoreteamname-mobile"/>
332-
</colgroup>
333-
<colgroup>
334-
<col id="scoresolv-mobile"/>
335-
</colgroup>
336342
337-
{% set teamColspan = 2 %}
338-
{% if showAffiliationLogos %}
339-
{% set teamColspan = teamColspan + 1 %}
340-
{% endif %}
341-
342-
<thead>
343-
<tr class="scoreheader" data-static="{{ static }}" style="font-size: 75%;">
344-
<th title="rank" scope="col">rank</th>
345-
<th title="team name" scope="col" colspan="{{ teamColspan }}">team</th>
346-
<th title="# solved / penalty time" colspan="1" scope="col">score</th>
347-
</tr>
348-
</thead>
349-
<tbody>
350-
{% set previousSortOrder = -1 %}
351-
{% set previousTeam = null %}
352-
{% set backgroundColors = {"#FFFFFF": 1} %}
353-
{% set medalCount = 0 %}
354-
{% for score in scores %}
355-
{% set classes = [] %}
356-
{% if score.team.category.sortorder != previousSortOrder %}
357-
{% set classes = classes | merge(['sortorderswitch']) %}
358-
{% set previousSortOrder = score.team.category.sortorder %}
343+
<thead>
344+
<tr class="scoreheader" data-static="{{ static }}" style="font-size: 75%;">
345+
<th title="rank" scope="col">rank</th>
346+
<th title="team name" scope="col" colspan="{{ teamColspan }}">team</th>
347+
<th title="# solved / penalty time" colspan="1" scope="col">score</th>
348+
</tr>
349+
</thead>
350+
<tbody>
351+
{% set previousSortOrder = -1 %}
359352
{% set previousTeam = null %}
360-
{% endif %}
353+
{% set backgroundColors = {"#FFFFFF": 1} %}
354+
{% set medalCount = 0 %}
355+
{% for score in scores %}
356+
{% set classes = [] %}
357+
{% if score.team.category.sortorder != previousSortOrder %}
358+
{% set classes = classes | merge(['sortorderswitch']) %}
359+
{% set previousSortOrder = score.team.category.sortorder %}
360+
{% set previousTeam = null %}
361+
{% endif %}
361362
362-
{# process medal color #}
363-
{% set medalColor = '' %}
364-
{% if showLegends %}
365-
{% set medalColor = score.team | medalType(contest, scoreboard) %}
366-
{% endif %}
363+
{# process medal color #}
364+
{% set medalColor = '' %}
365+
{% if showLegends %}
366+
{% set medalColor = score.team | medalType(contest, scoreboard) %}
367+
{% endif %}
367368
368-
{# check whether this is us, otherwise use category colour #}
369-
{% if myTeamId is defined and myTeamId == score.team.teamid %}
370-
{% set classes = classes | merge(['scorethisisme']) %}
371-
{% set color = '#FFFF99' %}
372-
{% else %}
373-
{% set color = score.team.category.color %}
374-
{% endif %}
375-
<tr class="{{ classes | join(' ') }}" id="team:{{ score.team.teamid }}:mobile" style="border-bottom-width: 0; height: 28px;">
376-
<td class="scorepl {{medalColor}}" rowspan="2">
377-
{# Only print rank when score is different from the previous team #}
378-
{% if not displayRank %}
379-
?
380-
{% elseif previousTeam is null or scoreboard.scores[previousTeam.teamid].rank != score.rank %}
381-
{{ score.rank }}
382-
{% else %}
383-
{% endif %}
384-
{% set previousTeam = score.team %}
385-
</td>
386-
<td class="scoreaf">
387-
{% if showFlags %}
388-
{% if score.team.affiliation %}
389-
{% set link = null %}
390-
{% if jury %}
391-
{% set link = path('jury_team_affiliation', {'affilId': score.team.affiliation.affilid}) %}
392-
{% endif %}
393-
<a {% if link %}href="{{ link }}"{% endif %}>
394-
{{ score.team.affiliation.country|countryFlag }}
395-
</a>
369+
{# check whether this is us, otherwise use category colour #}
370+
{% if myTeamId is defined and myTeamId == score.team.teamid %}
371+
{% set classes = classes | merge(['scorethisisme']) %}
372+
{% set color = '#FFFF99' %}
373+
{% else %}
374+
{% set color = score.team.category.color %}
375+
{% endif %}
376+
<tr class="{{ classes | join(' ') }}" id="team:{{ score.team.teamid }}:mobile" style="border-bottom-width: 0; height: 28px;">
377+
<td class="scorepl {{medalColor}}" rowspan="2">
378+
{# Only print rank when score is different from the previous team #}
379+
{% if not displayRank %}
380+
?
381+
{% elseif previousTeam is null or scoreboard.scores[previousTeam.teamid].rank != score.rank %}
382+
{{ score.rank }}
383+
{% else %}
396384
{% endif %}
397-
{% endif %}
398-
</td>
399-
{% if showAffiliationLogos %}
385+
{% set previousTeam = score.team %}
386+
</td>
400387
<td class="scoreaf">
401-
{% if score.team.affiliation %}
402-
{% set link = null %}
403-
{% if jury %}
404-
{% set link = path('jury_team_affiliation', {'affilId': score.team.affiliation.affilid}) %}
405-
{% endif %}
406-
<a {% if link %}href="{{ link }}"{% endif %}>
407-
{% set affiliationId = score.team.affiliation.affilid %}
408-
{% if showExternalId(score.team.affiliation) %}
409-
{% set affiliationId = score.team.affiliation.externalid %}
410-
{% endif %}
411-
{% set affiliationImage = affiliationId | assetPath('affiliation') %}
412-
{% if affiliationImage %}
413-
<img loading="lazy" width="16px" height="16px"
414-
src="{{ asset(affiliationImage) }}" alt="{{ score.team.affiliation.name }}"
415-
title="{{ score.team.affiliation.name }}">
416-
{% else %}
417-
{{ affiliationId }}
388+
{% if showFlags %}
389+
{% if score.team.affiliation %}
390+
{% set link = null %}
391+
{% if jury %}
392+
{% set link = path('jury_team_affiliation', {'affilId': score.team.affiliation.affilid}) %}
418393
{% endif %}
419-
</a>
394+
<a {% if link %}href="{{ link }}"{% endif %}>
395+
{{ score.team.affiliation.country|countryFlag }}
396+
</a>
397+
{% endif %}
420398
{% endif %}
421399
</td>
422-
{% endif %}
423-
{% if color is null %}
424-
{% set color = "#FFFFFF" %}
425-
{% set colorClass = "_FFFFFF" %}
426-
{% else %}
427-
{% set colorClass = color | replace({"#": "_"}) %}
428-
{% set backgroundColors = backgroundColors | merge({(color): 1}) %}
429-
{% endif %}
430-
<td class="scoretn cl{{ colorClass }}" title="{{ score.team.effectiveName }}">
431-
{% set link = null %}
432-
{% set extra = null %}
433-
{% if static %}
434-
{% set link = '#' %}
435-
{% set extra = 'data-bs-toggle="modal" data-bs-target="#team-modal-' ~ score.team.teamid ~ '"' %}
436-
{% else %}
437-
{% if jury %}
438-
{% set link = path('jury_team', {teamId: score.team.teamid}) %}
439-
{% elseif public %}
440-
{% set link = path('public_team', {teamId: score.team.teamid}) %}
441-
{% set extra = 'data-ajax-modal' %}
400+
{% if showAffiliationLogos %}
401+
<td class="scoreaf">
402+
{% if score.team.affiliation %}
403+
{% set link = null %}
404+
{% if jury %}
405+
{% set link = path('jury_team_affiliation', {'affilId': score.team.affiliation.affilid}) %}
406+
{% endif %}
407+
<a {% if link %}href="{{ link }}"{% endif %}>
408+
{% set affiliationId = score.team.affiliation.affilid %}
409+
{% if showExternalId(score.team.affiliation) %}
410+
{% set affiliationId = score.team.affiliation.externalid %}
411+
{% endif %}
412+
{% set affiliationImage = affiliationId | assetPath('affiliation') %}
413+
{% if affiliationImage %}
414+
<img loading="lazy" width="16px" height="16px"
415+
src="{{ asset(affiliationImage) }}" alt="{{ score.team.affiliation.name }}"
416+
title="{{ score.team.affiliation.name }}">
417+
{% else %}
418+
{{ affiliationId }}
419+
{% endif %}
420+
</a>
421+
{% endif %}
422+
</td>
423+
{% endif %}
424+
{% if color is null %}
425+
{% set color = "#FFFFFF" %}
426+
{% set colorClass = "_FFFFFF" %}
442427
{% else %}
443-
{% set link = path('team_team', {teamId: score.team.teamid}) %}
444-
{% set extra = 'data-ajax-modal' %}
428+
{% set colorClass = color | replace({"#": "_"}) %}
429+
{% set backgroundColors = backgroundColors | merge({(color): 1}) %}
445430
{% endif %}
446-
{% endif %}
447-
<a {% if extra is not null %}{{ extra | raw }}{% endif %} {% if link is not null %}href="{{ link }}"{% endif %}>
448-
<span class="forceWidth">
449-
{% if false and usedCategories | length > 1 and scoreboard.bestInCategory(score.team, limitToTeamIds) %}
450-
<span class="badge text-bg-warning category-best">
451-
{{ score.team.category.name }}
452-
</span>
453-
{% endif %}
454-
{{ score.team.effectiveName }}
455-
</span>
456-
{% if showAffiliations %}
457-
<span class="univ forceWidth">
458-
{% if score.team.affiliation %}
459-
{{ score.team.affiliation.name }}
431+
<td class="scoretn cl{{ colorClass }}" title="{{ score.team.effectiveName }}">
432+
{% set link = null %}
433+
{% set extra = null %}
434+
{% if static %}
435+
{% set link = '#' %}
436+
{% set extra = 'data-bs-toggle="modal" data-bs-target="#team-modal-' ~ score.team.teamid ~ '"' %}
437+
{% else %}
438+
{% if jury %}
439+
{% set link = path('jury_team', {teamId: score.team.teamid}) %}
440+
{% elseif public %}
441+
{% set link = path('public_team', {teamId: score.team.teamid}) %}
442+
{% set extra = 'data-ajax-modal' %}
443+
{% else %}
444+
{% set link = path('team_team', {teamId: score.team.teamid}) %}
445+
{% set extra = 'data-ajax-modal' %}
446+
{% endif %}
447+
{% endif %}
448+
<a {% if extra is not null %}{{ extra | raw }}{% endif %} {% if link is not null %}href="{{ link }}"{% endif %}>
449+
<span class="forceWidth">
450+
{% if false and usedCategories | length > 1 and scoreboard.bestInCategory(score.team, limitToTeamIds) %}
451+
<span class="badge text-bg-warning category-best">
452+
{{ score.team.category.name }}
453+
</span>
460454
{% endif %}
455+
{{ score.team.effectiveName }}
461456
</span>
462-
{% endif %}
463-
</a>
464-
</td>
465-
{% set totalTime = score.totalTime %}
466-
{% if scoreInSeconds %}
467-
{% set totalTime = totalTime | printTimeRelative %}
468-
{% endif %}
469-
{% set totalPoints = score.numPoints %}
470-
<td rowspan="2">{{ totalPoints }}<br/><span class="scorett" style="font-weight: normal;">{{ totalTime }}</span></td>
471-
</tr>
472-
<tr style="height: 32px;">
473-
<td colspan="{% if showAffiliationLogos %}3{% else %}2{% endif %}" class="text-end">
474-
<span class="mobile-problem-badges me-2 ms-2">
475-
{% for problem in problems %}
476-
{% set matrixItem = scoreboard.matrix[score.team.teamid][problem.probid] %}
477-
{{ problem | problemBadgeMaybe(matrixItem) }}
478-
{% endfor %}
479-
</span>
457+
{% if showAffiliations %}
458+
<span class="univ forceWidth">
459+
{% if score.team.affiliation %}
460+
{{ score.team.affiliation.name }}
461+
{% endif %}
462+
</span>
463+
{% endif %}
464+
</a>
480465
</td>
466+
{% set totalTime = score.totalTime %}
467+
{% if scoreInSeconds %}
468+
{% set totalTime = totalTime | printTimeRelative %}
469+
{% endif %}
470+
{% set totalPoints = score.numPoints %}
471+
<td rowspan="2">{{ totalPoints }}<br/><span class="scorett" style="font-weight: normal;">{{ totalTime }}</span></td>
481472
</tr>
482-
{% endfor %}
483-
</tbody>
484-
</table>
473+
<tr style="height: 32px;">
474+
<td colspan="{% if showAffiliationLogos %}3{% else %}2{% endif %}" class="text-end">
475+
<span class="mobile-problem-badges me-2 ms-2">
476+
{% for problem in problems %}
477+
{% set matrixItem = scoreboard.matrix[score.team.teamid][problem.probid] %}
478+
{{ problem | problemBadgeMaybe(matrixItem) }}
479+
{% endfor %}
480+
</span>
481+
</td>
482+
</tr>
483+
{% endfor %}
484+
</tbody>
485+
</table>
486+
{% endif %}
485487
486488
{% if static %}
487489
{% for score in scores %}

0 commit comments

Comments
 (0)