NDOJ/templates/contest/contest-tabs.html

83 lines
4.2 KiB
HTML
Raw Normal View History

2020-01-21 06:35:58 +00:00
{% extends "tabs-base.html" %}
{% block tabs %}
{{ make_tab('detail', 'fa-info-circle', url('contest_view', contest.key), _('Info')) }}
2021-05-24 20:00:36 +00:00
{% if contest.ended or can_edit %}
2020-01-21 06:35:58 +00:00
{{ make_tab('stats', 'fa-pie-chart', url('contest_stats', contest.key), _('Statistics')) }}
{% endif %}
{% if contest.start_time <= now or perms.judge.see_private_contest %}
2021-05-24 20:00:36 +00:00
{% if contest.can_see_own_scoreboard(request.user) %}
2020-01-21 06:35:58 +00:00
{{ make_tab('ranking', 'fa-bar-chart', url('contest_ranking', contest.key), _('Rankings')) }}
2021-05-24 20:00:36 +00:00
{% if request.user.is_authenticated %}
{{ make_tab('participation', 'fa-users', url('contest_participation_own', contest.key), _('Participation')) }}
{% endif %}
2020-01-21 06:35:58 +00:00
{% else %}
{{ make_tab('ranking', 'fa-bar-chart', None, _('Hidden Rankings')) }}
{% endif %}
{% endif %}
2021-05-24 20:00:36 +00:00
{% if can_edit %}
2020-01-21 06:35:58 +00:00
{% if perms.judge.moss_contest and has_moss_api_key %}
{{ make_tab('moss', 'fa-gavel', url('contest_moss', contest.key), _('MOSS')) }}
{% endif %}
{{ make_tab('edit', 'fa-edit', url('admin:judge_contest_change', contest.id), _('Edit')) }}
{% endif %}
{% if perms.judge.clone_contest %}
{{ make_tab('clone', 'fa-copy', url('contest_clone', contest.key), _('Clone')) }}
{% endif %}
{% if request.user.is_authenticated %}
2021-05-24 20:00:36 +00:00
{% if contest.can_join or is_editor or is_tester %}
{% set in_contest = contest.is_in_contest(request.user) %}
2020-01-21 06:35:58 +00:00
{% if contest.ended %}
2021-05-24 20:00:36 +00:00
{# Allow users to leave the virtual contest #}
2020-01-21 06:35:58 +00:00
{% if in_contest %}
<form action="{{ url('contest_leave', contest.key) }}" method="post"
2022-08-20 16:18:28 +00:00
class="contest-join-pseudotab btn-midnightblue">
2020-01-21 06:35:58 +00:00
{% csrf_token %}
<input type="submit" class="leaving-forever" value="{{ _('Leave contest') }}">
</form>
{% else %}
2021-05-24 20:00:36 +00:00
{# Allow users to virtual join #}
2020-01-21 06:35:58 +00:00
<form action="{{ url('contest_join', contest.key) }}" method="post"
2022-08-20 16:18:28 +00:00
class="contest-join-pseudotab btn-midnightblue">
2020-01-21 06:35:58 +00:00
{% csrf_token %}
<input type="submit" value="{{ _('Virtual join') }}">
</form>
{% endif %}
{% else %}
2021-05-24 20:00:36 +00:00
{# Allow users to leave the contest #}
2020-01-21 06:35:58 +00:00
{% if in_contest %}
<form action="{{ url('contest_leave', contest.key) }}" method="post"
2022-08-20 16:18:28 +00:00
class="contest-join-pseudotab">
2020-01-21 06:35:58 +00:00
{% csrf_token %}
2022-08-20 16:18:28 +00:00
<input type="submit" class="btn-midnightblue" value="
2021-05-24 20:00:36 +00:00
{%- if request.participation.spectate %}
2020-01-21 06:35:58 +00:00
{{- _('Stop spectating') -}}
{% else %}
{{- _('Leave contest') -}}
{% endif %}">
</form>
2021-05-24 20:00:36 +00:00
{% elif is_editor or is_tester or live_participation.ended %}
2022-08-20 16:18:28 +00:00
<form action="{{ url('contest_join', contest.key) }}" method="post" class="contest-join-pseudotab">
2020-01-21 06:35:58 +00:00
{% csrf_token %}
2022-08-20 16:18:28 +00:00
<input type="submit" class="btn-midnightblue" value="{{ _('Spectate contest') }}">
2020-01-21 06:35:58 +00:00
</form>
{% else %}
2022-08-20 16:18:28 +00:00
<form action="{{ url('contest_join', contest.key) }}" method="post" class="contest-join-pseudotab">
2020-01-21 06:35:58 +00:00
{% csrf_token %}
2022-08-20 16:18:28 +00:00
<input type="submit" class="btn-midnightblue {% if not has_joined %}first-join{% endif %}"
2021-05-24 20:00:36 +00:00
value="{{ _('Join contest') }}">
2020-01-21 06:35:58 +00:00
</form>
{% endif %}
{% endif %}
{% endif %}
{% elif contest.can_join %}
<form action="{{ url('auth_login') }}" method="get"
2022-11-12 08:11:28 +00:00
class="contest-join-pseudotab unselectable">
2020-01-21 06:35:58 +00:00
<input type="hidden" name="next" value="{{ LOGIN_RETURN_PATH|urlencode }}">
2022-11-12 08:11:28 +00:00
<input type="submit" class="btn-midnightblue" value="{{ _('Login to participate') }}">
2020-01-21 06:35:58 +00:00
</form>
{% endif %}
{% endblock %}