NDOJ/templates/contest/contest.html

159 lines
5.7 KiB
HTML
Raw Normal View History

2022-11-27 07:03:38 +00:00
{% extends "two-column-content.html" %}
{% set page_type = 'detail' %}
2022-11-28 00:13:40 +00:00
{% block middle_title %}
2023-01-27 23:11:10 +00:00
<h2>{{contest.name}}</h2>
2022-11-28 00:13:40 +00:00
{% endblock %}
2022-11-27 07:03:38 +00:00
{% block left_sidebar %}
2023-01-27 23:11:10 +00:00
{% set title = contest.name %}
{% include "contest/contest-tabs.html" %}
2020-01-21 06:35:58 +00:00
{% endblock %}
2024-06-24 19:56:00 +00:00
{% block js_media %}
2023-01-27 23:11:10 +00:00
{% include "contest/media-js.html" %}
{% include "comments/media-js.html" %}
{% include "actionbar/media-js.html" %}
2023-11-27 00:05:19 +00:00
{% include "contest/contest-datetime-js.html" %}
2020-01-21 06:35:58 +00:00
{% endblock %}
2022-11-27 07:03:38 +00:00
{% block two_col_media %}
2023-01-27 23:11:10 +00:00
{% include "comments/media-css.html" %}
2020-01-21 06:35:58 +00:00
{% endblock %}
2022-11-27 07:03:38 +00:00
{% block middle_content %}
2023-01-27 23:11:10 +00:00
{% include "contest/contest-datetime.html" %}
2020-01-21 06:35:58 +00:00
2023-01-27 23:11:10 +00:00
{% if request.user.is_authenticated %}
{% 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 %}
<form action="{{ url('contest_leave', contest.key) }}" method="post"
class="contest-join-pseudotab btn-red">
{% csrf_token %}
<input type="submit" class="leaving-forever" value="{{ _('Leave contest') }}">
</form>
{% else %}
{# Allow users to virtual join #}
<form action="{{ url('contest_join', contest.key) }}" method="post"
class="contest-join-pseudotab btn-midnightblue">
{% csrf_token %}
<input type="submit" value="{{ _('Virtual join') }}">
</form>
2022-11-27 07:23:04 +00:00
{% endif %}
2023-01-27 23:11:10 +00:00
{% else %}
{# Allow users to leave the contest #}
{% if in_contest %}
<form action="{{ url('contest_leave', contest.key) }}" method="post"
class="contest-join-pseudotab">
{% csrf_token %}
<input type="submit" class="btn-midnightblue" value="
{%- if request.participation.spectate %}
{{- _('Stop spectating') -}}
{% else %}
{{- _('Leave contest') -}}
{% endif %}">
</form>
{% elif is_editor or is_tester or live_participation.ended %}
<form action="{{ url('contest_join', contest.key) }}" method="post" class="contest-join-pseudotab">
{% csrf_token %}
<input type="submit" class="btn-midnightblue" value="{{ _('Spectate contest') }}">
</form>
{% else %}
<form action="{{ url('contest_join', contest.key) }}" method="post" class="contest-join-pseudotab">
{% csrf_token %}
<input type="submit" class="btn-midnightblue {% if not has_joined %}first-join{% endif %}"
value="{{ _('Join contest') }}">
</form>
{% endif %}
{% endif %}
2022-11-27 07:23:04 +00:00
{% endif %}
2023-01-27 23:11:10 +00:00
{% elif contest.can_join %}
<form action="{{ url('auth_login') }}" method="get"
class="contest-join-pseudotab unselectable">
<input type="hidden" name="next" value="{{ LOGIN_RETURN_PATH|urlencode }}">
<input type="submit" class="btn-midnightblue" value="{{ _('Login to participate') }}">
</form>
{% endif %}
2023-07-13 15:07:25 +00:00
<div style="clear: both"></div>
2024-01-30 02:43:28 +00:00
{% if contest.is_organization_private %}
2024-04-23 20:36:51 +00:00
<div style="display: flex; margin-bottom: 1em">
{% for org in contest.organizations.all() %}
{% include "organization/tag.html" %}
{% endfor %}
</div>
2024-01-30 02:43:28 +00:00
{% endif %}
2023-10-16 22:37:52 +00:00
{% if editable_organizations or is_clonable %}
<div style="display: flex; gap: 0.5em;">
2023-01-27 23:11:10 +00:00
{% for org in editable_organizations %}
<span> [<a href="{{ url('organization_contest_edit', org.id , org.slug , contest.key) }}">{{ _('Edit in') }} {{org.slug}}</a>]</span>
{% endfor %}
2023-10-16 22:37:52 +00:00
{% if is_clonable %}
<span>
[<a href="{{url('contest_clone', contest.key)}}"}}>{{_('Clone')}}</a>]
</span>
{% endif %}
2020-01-21 06:35:58 +00:00
</div>
2023-01-27 23:11:10 +00:00
{% endif %}
2020-01-21 06:35:58 +00:00
2024-01-30 02:43:28 +00:00
<div style="padding: 0 1em;">
2024-02-26 20:49:52 +00:00
{% cache 3600 'contest_html' contest.id %}
2024-01-30 02:43:28 +00:00
{{ contest.description|markdown|reference|str|safe }}
{% endcache %}
</div>
2023-01-27 23:11:10 +00:00
{% if contest.ended or request.user.is_superuser or is_editor or is_tester %}
<hr>
<div class="contest-problems">
<h2 style="margin-bottom: 0.2em"><i class="fa fa-fw fa-question-circle"></i>{{ _('Problems') }} </h2>
<table id="contest-problems" class="table">
<thead>
<tr>
<th>{{ _('Problem') }}</th>
<th>{{ _('Points') }}</th>
<th>{{ _('AC Rate') }}</th>
<th>{{ _('Users') }}</th>
<th></th>
</tr>
</thead>
<tbody>
{% for problem in contest_problems %}
<tr>
<td>
{% if problem.is_public %}
<a href="{{ url('problem_detail', problem.code) }}">{{ problem.i18n_name }}</a>
{% else %}
{{ problem.i18n_name }}
{% endif %}
</td>
<td>{{ problem.points|floatformat }}{% if problem.partial %}p{% endif %}</td>
<td>{{ problem.ac_rate|floatformat(1) }}%</td>
<td>
{% if problem.is_public %}
<a href="{{ url('ranked_submissions', problem.code) }}">{{ problem.user_count }}</a>
{% else %}
{{ problem.user_count }}
{% endif %}
</td>
<td>
{% if problem.is_public and problem.has_public_editorial %}
<a href="{{ url('problem_editorial', problem.code) }}">{{ _('Editorial') }}</a>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<hr>
{% endif %}
<div style="clear: both"></div>
<br>
2023-01-27 23:11:10 +00:00
{% include "actionbar/list.html" %}
<br>
{% include "comments/list.html" %}
2022-11-27 07:03:38 +00:00
{% endblock %}