Add contest tester/curator (DMOJ)

This commit is contained in:
cuom1999 2021-05-24 15:00:36 -05:00
parent 06318a97e5
commit 297b8a2a36
25 changed files with 611 additions and 230 deletions

View file

@ -2,21 +2,21 @@
{% block tabs %}
{{ make_tab('detail', 'fa-info-circle', url('contest_view', contest.key), _('Info')) }}
{% if contest.ended or contest.is_editable_by(request.user) %}
{% if contest.ended or can_edit %}
{{ make_tab('stats', 'fa-pie-chart', url('contest_stats', contest.key), _('Statistics')) }}
{% endif %}
{% if contest.start_time <= now or perms.judge.see_private_contest %}
{% if contest.show_scoreboard or contest.can_see_scoreboard(request.user) %}
{% if contest.can_see_own_scoreboard(request.user) %}
{{ make_tab('ranking', 'fa-bar-chart', url('contest_ranking', contest.key), _('Rankings')) }}
{% if request.user.is_authenticated %}
{{ make_tab('participation', 'fa-users', url('contest_participation_own', contest.key), _('Participation')) }}
{% endif %}
{% else %}
{{ make_tab('ranking', 'fa-bar-chart', None, _('Hidden Rankings')) }}
{% endif %}
{% if contest.show_scoreboard and request.user.is_authenticated %}
{{ make_tab('participation', 'fa-users', url('contest_participation_own', contest.key), _('Participation')) }}
{% endif %}
{% endif %}
{% if contest.is_editable_by(request.user) %}
{% if can_edit %}
{% if perms.judge.moss_contest and has_moss_api_key %}
{{ make_tab('moss', 'fa-gavel', url('contest_moss', contest.key), _('MOSS')) }}
{% endif %}
@ -27,17 +27,18 @@
{% endif %}
{% if request.user.is_authenticated %}
{% if contest.can_join or participating or is_organizer %}
{% if contest.can_join or is_editor or is_tester %}
{% set in_contest = contest.is_in_contest(request.user) %}
{% if contest.ended %}
{# Allow users to leave the virtual contest #}
{% if in_contest %}
{# They're in the contest because they're participating virtually #}
<form action="{{ url('contest_leave', contest.key) }}" method="post"
class="contest-join-pseudotab unselectable button full">
{% csrf_token %}
<input type="submit" class="leaving-forever" value="{{ _('Leave contest') }}">
</form>
{% else %}
{# They're in the contest because they're participating virtually #}
{# Allow users to virtual join #}
<form action="{{ url('contest_join', contest.key) }}" method="post"
class="contest-join-pseudotab unselectable button full">
{% csrf_token %}
@ -45,35 +46,30 @@
</form>
{% endif %}
{% else %}
{# Allow users to leave the contest #}
{% if in_contest %}
{# Allow people with ended participations to continue spectating #}
<form action="{{ url('contest_leave', contest.key) }}" method="post"
class="contest-join-pseudotab unselectable button full">
{% csrf_token %}
<input type="submit" value="
{%- if participating and participation.ended or request.profile in contest.organizers.all() %}
{%- if request.participation.spectate %}
{{- _('Stop spectating') -}}
{% else %}
{{- _('Leave contest') -}}
{% endif %}">
</form>
{% elif participating and participation.ended or is_organizer %}
{% elif is_editor or is_tester or live_participation.ended %}
<form action="{{ url('contest_join', contest.key) }}" method="post"
class="contest-join-pseudotab unselectable button full">
{% csrf_token %}
<input type="submit" value="{{ _('Spectate contest') }}">
</form>
{% elif participating %}
<form action="{{ url('contest_join', contest.key) }}" method="post"
class="contest-join-pseudotab unselectable button full">
{% csrf_token %}
<input type="submit" value="{{ _('Join contest') }}">
</form>
{% else %}
<form action="{{ url('contest_join', contest.key) }}" method="post"
class="contest-join-pseudotab unselectable button full">
{% csrf_token %}
<input type="submit" class="first-join" value="{{ _('Join contest') }}">
<input type="submit" {% if not has_joined %}class="first-join"{% endif %}
value="{{ _('Join contest') }}">
</form>
{% endif %}
{% endif %}