Reformat html files

This commit is contained in:
cuom1999 2023-01-27 17:11:10 -06:00
parent 9a208ca108
commit 52f1e77fe1
205 changed files with 11096 additions and 11086 deletions

View file

@ -1,35 +1,35 @@
{% extends "base.html" %}
{% block media %}
<style>
#access-code-form {
margin: 50px auto 0;
display: block;
max-width: 500px;
}
<style>
#access-code-form {
margin: 50px auto 0;
display: block;
max-width: 500px;
}
#id_access_code {
width: 100%;
}
#id_access_code {
width: 100%;
}
.button-line {
text-align: right;
}
</style>
.button-line {
text-align: right;
}
</style>
{% endblock %}
{% block body %}
<form id="access-code-form" action="" method="post" class="form-area">
{% csrf_token %}
{% if form.errors or wrong_code %}
<div id="form-errors">
<p class="error">{{ _('Invalid access code.') }}</p>
</div>
{% endif %}
<p>{{ _('Please enter your access code:') }}</p>
<p>{{ form.access_code }}</p>
<p class="button-line">
<button type="submit">{{ _('Join Contest') }}</button>
</p>
</form>
<form id="access-code-form" action="" method="post" class="form-area">
{% csrf_token %}
{% if form.errors or wrong_code %}
<div id="form-errors">
<p class="error">{{ _('Invalid access code.') }}</p>
</div>
{% endif %}
<p>{{ _('Please enter your access code:') }}</p>
<p>{{ form.access_code }}</p>
<p class="button-line">
<button type="submit">{{ _('Join Contest') }}</button>
</p>
</form>
{% endblock %}

View file

@ -2,55 +2,55 @@
{% set page_type = 'calendar' %}
{% block left_sidebar %}
{% include "contest/contest-list-tabs.html" %}
{% include "contest/contest-list-tabs.html" %}
{% endblock %}
{% block middle_content %}
<center style="font-size: 1.6em; margin-top: 0.3em;">
{% if prev_month %}
<a href="{{ url('contest_calendar', prev_month.year, prev_month.month) }}">&laquo; {{ _('Prev') }}</a>
{% endif %}
{% if not (curr_month.year == now.year and curr_month.month == now.month) %}
<a href="{{ url('contest_calendar', now.year, now.month) }}"> {{ _('Today') }}</a>
{% endif %}
{% if next_month %}
<a href="{{ url('contest_calendar', next_month.year, next_month.month) }}">{{ _('Next') }} &raquo;</a>
{% endif %}
</center>
<table id="contest-calendar">
<tr>
<th>{{ _('Sunday') }}</th>
<th>{{ _('Monday') }}</th>
<th>{{ _('Tuesday') }}</th>
<th>{{ _('Wednesday') }}</th>
<th>{{ _('Thursday') }}</th>
<th>{{ _('Friday') }}</th>
<th>{{ _('Saturday') }}</th>
</tr>
{% for week in calendar %}
<tr>{% for day in week %}
<td class="{{ day.weekday }}{% if day.is_today %} today{% endif %}{% if day.is_pad %} noday{% endif %}">
<span class="num">{{ day.date.day }}</span>
<ul class="fa-ul">
{% for contest in day.starts %}
<li class="start"><i class="fa fa-li fa-lg fa-step-forward"></i>
<a href="{{ url('contest_view', contest.key) }}">{{ contest.name }}</a>
</li>
{% endfor %}
{% for contest in day.oneday %}
<li class="oneday">
<i class="fa fa-li fa-lg fa-play"></i>
<a href="{{ url('contest_view', contest.key) }}">{{ contest.name }}</a>
</li>
{% endfor %}
{% for contest in day.ends %}
<li class="end"><i class="fa fa-li fa-lg fa-step-backward"></i>
<a href="{{ url('contest_view', contest.key) }}">{{ contest.name }}</a>
</li>
{% endfor %}
</ul>
</td>
{% endfor %}</tr>
{% endfor %}
</table>
<center style="font-size: 1.6em; margin-top: 0.3em;">
{% if prev_month %}
<a href="{{ url('contest_calendar', prev_month.year, prev_month.month) }}">&laquo; {{ _('Prev') }}</a>
{% endif %}
{% if not (curr_month.year == now.year and curr_month.month == now.month) %}
<a href="{{ url('contest_calendar', now.year, now.month) }}"> {{ _('Today') }}</a>
{% endif %}
{% if next_month %}
<a href="{{ url('contest_calendar', next_month.year, next_month.month) }}">{{ _('Next') }} &raquo;</a>
{% endif %}
</center>
<table id="contest-calendar">
<tr>
<th>{{ _('Sunday') }}</th>
<th>{{ _('Monday') }}</th>
<th>{{ _('Tuesday') }}</th>
<th>{{ _('Wednesday') }}</th>
<th>{{ _('Thursday') }}</th>
<th>{{ _('Friday') }}</th>
<th>{{ _('Saturday') }}</th>
</tr>
{% for week in calendar %}
<tr>{% for day in week %}
<td class="{{ day.weekday }}{% if day.is_today %} today{% endif %}{% if day.is_pad %} noday{% endif %}">
<span class="num">{{ day.date.day }}</span>
<ul class="fa-ul">
{% for contest in day.starts %}
<li class="start"><i class="fa fa-li fa-lg fa-step-forward"></i>
<a href="{{ url('contest_view', contest.key) }}">{{ contest.name }}</a>
</li>
{% endfor %}
{% for contest in day.oneday %}
<li class="oneday">
<i class="fa fa-li fa-lg fa-play"></i>
<a href="{{ url('contest_view', contest.key) }}">{{ contest.name }}</a>
</li>
{% endfor %}
{% for contest in day.ends %}
<li class="end"><i class="fa fa-li fa-lg fa-step-backward"></i>
<a href="{{ url('contest_view', contest.key) }}">{{ contest.name }}</a>
</li>
{% endfor %}
</ul>
</td>
{% endfor %}</tr>
{% endfor %}
</table>
{% endblock %}

View file

@ -1,54 +1,54 @@
{% extends "base.html" %}
{% block media %}
{{ form.media.css }}
<style>
form#clarification-form {
display: block;
margin: 0 auto;
width: 100%;
max-width: 750px;
padding-top: 1em;
}
{{ form.media.css }}
<style>
form#clarification-form {
display: block;
margin: 0 auto;
width: 100%;
max-width: 750px;
padding-top: 1em;
}
#id_title {
width: 100%;
}
#id_title {
width: 100%;
}
form#clarification-form .submit {
margin: 10px 0 0 auto;
}
</style>
form#clarification-form .submit {
margin: 10px 0 0 auto;
}
</style>
{% endblock %}
{% block js_media %}
{{ form.media.js }}
<script>
{{ form.media.js }}
<script>
$(function() {
$('#problem-select').select2({width: '40em'});
$('#problem-select').select2({width: '40em'});
});
</script>
</script>
{% endblock %}
{% block body %}
<form id="clarification-form" action="" method="POST" class="form-area">
{% csrf_token %}
{% if form.body.errors %}
<div class="form-errors">
{{ form.body.errors }}
</div>
{% endif %}
<h4>
<span>{{_('Problem')}}: </span>
<select name="problem" id="problem-select">
{% for problem in problems %}
<option value="{{ problem.problem.code }}" class="point-dropdown">
{{ problem.order }}. {{problem.problem.name}}
</option>
{% endfor %}
</select>
</h4>
<div class="body-block">{{ form.body }}</div>
<button type="submit" class="submit">{{ _('Create') }}</button>
</form>
<form id="clarification-form" action="" method="POST" class="form-area">
{% csrf_token %}
{% if form.body.errors %}
<div class="form-errors">
{{ form.body.errors }}
</div>
{% endif %}
<h4>
<span>{{_('Problem')}}: </span>
<select name="problem" id="problem-select">
{% for problem in problems %}
<option value="{{ problem.problem.code }}" class="point-dropdown">
{{ problem.order }}. {{problem.problem.name}}
</option>
{% endfor %}
</select>
</h4>
<div class="body-block">{{ form.body }}</div>
<button type="submit" class="submit">{{ _('Create') }}</button>
</form>
{% endblock %}

View file

@ -1,42 +1,42 @@
{% extends "base.html" %}
{% block media %}
<style>
#contest-clone-panel {
position: relative;
margin: 5em auto auto -10em;
top: 40%;
left: 50%;
}
<style>
#contest-clone-panel {
position: relative;
margin: 5em auto auto -10em;
top: 40%;
left: 50%;
}
#contest-key-container {
margin: 0.5em 0;
}
#contest-key-container {
margin: 0.5em 0;
}
#id_key {
width: 100%;
}
#id_key {
width: 100%;
}
ul.errorlist {
list-style-type: none;
padding-left: 0;
text-align: center;
}
</style>
ul.errorlist {
list-style-type: none;
padding-left: 0;
text-align: center;
}
</style>
{% endblock %}
{% block body %}
<form id="contest-clone-panel" action="" method="post" class="form-area">
{% csrf_token %}
{% if form.errors %}
<div id="form-errors">
{{ form.key.errors }}
</div>
{% endif %}
<form id="contest-clone-panel" action="" method="post" class="form-area">
{% csrf_token %}
{% if form.errors %}
<div id="form-errors">
{{ form.key.errors }}
</div>
{% endif %}
<div><label class="inline-header grayed">{{ _('Enter a new key for the cloned contest:') }}</label></div>
<div id="contest-key-container"><span class="fullwidth">{{ form.key }}</span></div>
<hr>
<button style="float: right;" type="submit">{{ _('Clone!') }}</button>
</form>
<div><label class="inline-header grayed">{{ _('Enter a new key for the cloned contest:') }}</label></div>
<div id="contest-key-container"><span class="fullwidth">{{ form.key }}</span></div>
<hr>
<button style="float: right;" type="submit">{{ _('Clone!') }}</button>
</form>
{% endblock %}

View file

@ -1,53 +1,53 @@
<script type="text/javascript">
$(document).ready(function () {
$('.time-remaining').each(function () {
count_down($(this));
});
});
</script>
<div id="banner">
<a href="https://www.timeanddate.com/worldclock/fixedtime.html?msg={{ contest.name|urlquote('') }}&amp;iso=
{{- contest.start_time|utc|date('Y-m-d\TH:i:s') }}" class="date">
{%- if contest.is_in_contest(request.user) and not request.participation.live -%}
{% if request.participation.spectate %}
{% trans countdown=contest.end_time|as_countdown %}Spectating, contest ends in {{countdown}}.{% endtrans %}
{% elif request.participation.end_time %}
{% trans countdown=request.participation.end_time|as_countdown %}Participating virtually, {{countdown}} remaining.{% endtrans %}
{% else %}
{{- _('Participating virtually.') -}}
{% endif %}
{%- else -%}
{% if contest.start_time > now %}
{% trans countdown=contest.start_time|as_countdown %}Starting in {{countdown}}.{% endtrans %}
{% elif contest.end_time < now %}
{{- _('Contest is over.') -}}
{% else %}
{%- if has_joined -%}
{% if live_participation.ended %}
{% trans countdown=contest.end_time|as_countdown %}Your time is up! Contest ends in {{countdown}}.{% endtrans %}
{% else %}
{% trans countdown=live_participation.end_time|as_countdown %}You have {{countdown}} remaining.{% endtrans %}
{% endif %}
{%- else -%}
{% trans countdown=contest.end_time|as_countdown %}Contest ends in {{countdown}}.{% endtrans %}
{%- endif -%}
{% endif %}
{%- endif -%}
</a>
<div class="time">
{% if contest.time_limit %}
{% trans trimmed start_time=contest.start_time|date(_("F j, Y, G:i T")), end_time=contest.end_time|date(_("F j, Y, G:i T")), time_limit=contest.time_limit|timedelta('localized-no-seconds') %}
<b>{{ time_limit }}</b> window between <b>{{ start_time }}</b> and <b>{{ end_time }}</b>
{% endtrans %}
{% else %}
{% trans trimmed length=contest.contest_window_length|timedelta("localized-no-seconds"), start_time=contest.start_time|date(_("F j, Y, G:i T")) %}
<b>{{ length }}</b> long starting on <b>{{ start_time }}</b>
{% endtrans %}
{% endif %}
</div>
{% if contest.freeze_after and contest.freeze_after + contest.start_time < now %}
<div class="time" style="margin-top: 0.2em">
<b>{{_("Standing was frozen")}}</b> {{_("at")}} <b>{{ (contest.freeze_after + contest.start_time) | date(_("F j, Y, G:i T")) }}</b>
</div>
{% endif %}
<script type="text/javascript">
$(document).ready(function () {
$('.time-remaining').each(function () {
count_down($(this));
});
});
</script>
<div id="banner">
<a href="https://www.timeanddate.com/worldclock/fixedtime.html?msg={{ contest.name|urlquote('') }}&amp;iso=
{{- contest.start_time|utc|date('Y-m-d\TH:i:s') }}" class="date">
{%- if contest.is_in_contest(request.user) and not request.participation.live -%}
{% if request.participation.spectate %}
{% trans countdown=contest.end_time|as_countdown %}Spectating, contest ends in {{countdown}}.{% endtrans %}
{% elif request.participation.end_time %}
{% trans countdown=request.participation.end_time|as_countdown %}Participating virtually, {{countdown}} remaining.{% endtrans %}
{% else %}
{{- _('Participating virtually.') -}}
{% endif %}
{%- else -%}
{% if contest.start_time > now %}
{% trans countdown=contest.start_time|as_countdown %}Starting in {{countdown}}.{% endtrans %}
{% elif contest.end_time < now %}
{{- _('Contest is over.') -}}
{% else %}
{%- if has_joined -%}
{% if live_participation.ended %}
{% trans countdown=contest.end_time|as_countdown %}Your time is up! Contest ends in {{countdown}}.{% endtrans %}
{% else %}
{% trans countdown=live_participation.end_time|as_countdown %}You have {{countdown}} remaining.{% endtrans %}
{% endif %}
{%- else -%}
{% trans countdown=contest.end_time|as_countdown %}Contest ends in {{countdown}}.{% endtrans %}
{%- endif -%}
{% endif %}
{%- endif -%}
</a>
<div class="time">
{% if contest.time_limit %}
{% trans trimmed start_time=contest.start_time|date(_("F j, Y, G:i T")), end_time=contest.end_time|date(_("F j, Y, G:i T")), time_limit=contest.time_limit|timedelta('localized-no-seconds') %}
<b>{{ time_limit }}</b> window between <b>{{ start_time }}</b> and <b>{{ end_time }}</b>
{% endtrans %}
{% else %}
{% trans trimmed length=contest.contest_window_length|timedelta("localized-no-seconds"), start_time=contest.start_time|date(_("F j, Y, G:i T")) %}
<b>{{ length }}</b> long starting on <b>{{ start_time }}</b>
{% endtrans %}
{% endif %}
</div>
{% if contest.freeze_after and contest.freeze_after + contest.start_time < now %}
<div class="time" style="margin-top: 0.2em">
<b>{{_("Standing was frozen")}}</b> {{_("at")}} <b>{{ (contest.freeze_after + contest.start_time) | date(_("F j, Y, G:i T")) }}</b>
</div>
{% endif %}
</div>

View file

@ -1,5 +1,5 @@
<div class="left-sidebar">
{{ make_tab_item('list', 'fa fa-list', url('contest_list'), _('List')) }}
{{ make_tab_item('calendar', 'fa fa-calendar', url('contest_calendar', now.year, now.month), _('Calendar')) }}
{{ make_tab_item('admin', 'fa fa-edit', url('admin:judge_contest_changelist'), _('Admin')) }}
{{ make_tab_item('list', 'fa fa-list', url('contest_list'), _('List')) }}
{{ make_tab_item('calendar', 'fa fa-calendar', url('contest_calendar', now.year, now.month), _('Calendar')) }}
{{ make_tab_item('admin', 'fa fa-edit', url('admin:judge_contest_changelist'), _('Admin')) }}
</div>

View file

@ -1,40 +1,40 @@
<style>
@media(max-width: 799px) {
.middle-right-content {
margin-left: 8px;
margin-right: 8px;
}
@media(max-width: 799px) {
.middle-right-content {
margin-left: 8px;
margin-right: 8px;
}
}
</style>
<div class="left-sidebar">
{{ make_tab_item('detail', 'fa fa-info-circle', url('contest_view', contest.key), _('Info')) }}
{% if contest.ended or can_edit %}
{{ make_tab_item('stats', 'fa fa-pie-chart', url('contest_stats', contest.key), _('Statistics')) }}
{% endif %}
{{ make_tab_item('detail', 'fa fa-info-circle', url('contest_view', contest.key), _('Info')) }}
{% if contest.ended or can_edit %}
{{ make_tab_item('stats', 'fa fa-pie-chart', url('contest_stats', contest.key), _('Statistics')) }}
{% endif %}
{% if contest.start_time <= now or perms.judge.see_private_contest %}
{% if contest.can_see_own_scoreboard(request.user) %}
{{ make_tab_item('ranking', 'fa fa-bar-chart', url('contest_ranking', contest.key), _('Rankings')) }}
{% if request.user.is_authenticated %}
{{ make_tab_item('participation', 'fa fa-users', url('contest_participation_own', contest.key), _('Participation')) }}
{% endif %}
{% else %}
{{ make_tab_item('ranking', 'fa fa-bar-chart', None, _('Hidden Rankings')) }}
{% endif %}
{% if contest.start_time <= now or perms.judge.see_private_contest %}
{% if contest.can_see_own_scoreboard(request.user) %}
{{ make_tab_item('ranking', 'fa fa-bar-chart', url('contest_ranking', contest.key), _('Rankings')) }}
{% if request.user.is_authenticated %}
{{ make_tab_item('participation', 'fa fa-users', url('contest_participation_own', contest.key), _('Participation')) }}
{% endif %}
{% else %}
{{ make_tab_item('ranking', 'fa fa-bar-chart', None, _('Hidden Rankings')) }}
{% endif %}
{% if request.user.is_superuser and contest_has_hidden_subtasks %}
{{ make_tab_item('resolver', 'fa fa-check', url('resolver', contest.key), _('Resolver')) }}
{% endif %}
{% if show_final_ranking %}
{{ make_tab_item('final_ranking', 'fa fa-bar-chart', url('contest_final_ranking', contest.key), _('Final rankings')) }}
{% endif %}
{% if can_edit %}
{% if perms.judge.moss_contest and has_moss_api_key %}
{{ make_tab_item('moss', 'fa fa-gavel', url('contest_moss', contest.key), _('MOSS')) }}
{% endif %}
{{ make_tab_item('edit', 'fa fa-edit', url('admin:judge_contest_change', contest.id), _('Edit')) }}
{% endif %}
{% if perms.judge.clone_contest %}
{{ make_tab_item('clone', 'fa fa-copy', url('contest_clone', contest.key), _('Clone')) }}
{% endif %}
{% if request.user.is_superuser and contest_has_hidden_subtasks %}
{{ make_tab_item('resolver', 'fa fa-check', url('resolver', contest.key), _('Resolver')) }}
{% endif %}
{% if show_final_ranking %}
{{ make_tab_item('final_ranking', 'fa fa-bar-chart', url('contest_final_ranking', contest.key), _('Final rankings')) }}
{% endif %}
{% if can_edit %}
{% if perms.judge.moss_contest and has_moss_api_key %}
{{ make_tab_item('moss', 'fa fa-gavel', url('contest_moss', contest.key), _('MOSS')) }}
{% endif %}
{{ make_tab_item('edit', 'fa fa-edit', url('admin:judge_contest_change', contest.id), _('Edit')) }}
{% endif %}
{% if perms.judge.clone_contest %}
{{ make_tab_item('clone', 'fa fa-copy', url('contest_clone', contest.key), _('Clone')) }}
{% endif %}
</div>

View file

@ -2,141 +2,141 @@
{% set page_type = 'detail' %}
{% block middle_title %}
<h2>{{contest.name}}</h2>
<h2>{{contest.name}}</h2>
{% endblock %}
{% block left_sidebar %}
{% set title = contest.name %}
{% include "contest/contest-tabs.html" %}
{% set title = contest.name %}
{% include "contest/contest-tabs.html" %}
{% endblock %}
{% block two_col_js %}
{% include "contest/media-js.html" %}
{% include "comments/media-js.html" %}
{% include "actionbar/media-js.html" %}
{% include "contest/media-js.html" %}
{% include "comments/media-js.html" %}
{% include "actionbar/media-js.html" %}
{% endblock %}
{% block two_col_media %}
{% include "comments/media-css.html" %}
{% include "actionbar/media-css.html" %}
{% include "comments/media-css.html" %}
{% include "actionbar/media-css.html" %}
{% endblock %}
{% block middle_content %}
{% include "contest/contest-datetime.html" %}
{% include "contest/contest-datetime.html" %}
{% 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>
{% endif %}
{% 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 %}
{% 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>
{% endif %}
{% 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>
{% 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 %}
{% endif %}
{% 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 %}
<div class="content-description">
{% cache 3600 'contest_html' contest.id MATH_ENGINE %}
{{ contest.description|markdown|reference|str|safe }}
{% endcache %}
<div class="content-description">
{% cache 3600 'contest_html' contest.id MATH_ENGINE %}
{{ contest.description|markdown|reference|str|safe }}
{% endcache %}
</div>
{% if editable_organizations %}
<div>
{% 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 %}
</div>
{% if editable_organizations %}
<div>
{% 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 %}
</div>
{% endif %}
{% endif %}
{% 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 %}
{% include "actionbar/list.html" %}
<br>
{% include "comments/list.html" %}
{% 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 %}
{% include "actionbar/list.html" %}
<br>
{% include "comments/list.html" %}
{% endblock %}

View file

@ -1,404 +1,404 @@
{% extends "two-column-content.html" %}
{% block meta %}
<meta name="description" content="The {{ SITE_NAME }}'s contest list - past, present, and future.">
<meta name="description" content="The {{ SITE_NAME }}'s contest list - past, present, and future.">
{% endblock %}
{% block two_col_media %}
<style>
.content-description ul {
padding: 0 !important;
}
<style>
.content-description ul {
padding: 0 !important;
}
.btn-contest {
display: inline-block;
padding: 1px 6px;
}
.btn-contest {
display: inline-block;
padding: 1px 6px;
}
.contest-group-header {
padding-bottom: 1em;
}
.contest-group-header {
padding-bottom: 1em;
}
{% if page_obj and page_obj.number > 1%}
#ongoing-table {
display: none;
}
{% endif %}
{% if page_obj and page_obj.number > 1%}
#ongoing-table {
display: none;
}
{% endif %}
@media (max-width: 500px) {
#search-contest, #search-org, #search-btn {
width: 100%;
margin-bottom: 0.5em;
}
#search-contest {
height: 2.5em;
}
#search-btn {
margin-top: 0.5em;
}
#filter-form input {
padding-left: 8px;
}
}
@media (max-width: 500px) {
#search-contest, #search-org, #search-btn {
width: 100%;
margin-bottom: 0.5em;
}
#search-contest {
height: 2.5em;
}
#search-btn {
margin-top: 0.5em;
}
#filter-form input {
padding-left: 8px;
}
}
@media (min-width: 500px) {
#filter-form input {
margin: 0 0.5em 0 0!important;
padding-left: 8px;
padding-top: 8px;
}
#search-contest {
width: 30%;
height: 2.3em;
margin-right: 1em;
margin-bottom: 0;
padding-top: 4px !important;
}
@media (min-width: 500px) {
#filter-form input {
margin: 0 0.5em 0 0!important;
padding-left: 8px;
padding-top: 8px;
}
#search-contest {
width: 30%;
height: 2.3em;
margin-right: 1em;
margin-bottom: 0;
padding-top: 4px !important;
}
#search-org {
width: 40%;
}
#search-org {
width: 40%;
}
#search-btn {
display: inline-block;
height: 2.3em;
margin-left: 0.5em;
}
}
</style>
#search-btn {
display: inline-block;
height: 2.3em;
margin-left: 0.5em;
}
}
</style>
{% endblock %}
{% block two_col_js %}
<script src="{{ static('libs/featherlight/featherlight.min.js') }}" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$('.time-remaining').each(function () {
count_down($(this));
});
<script src="{{ static('libs/featherlight/featherlight.min.js') }}" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$('.time-remaining').each(function () {
count_down($(this));
});
$('.contest-tag').find('a[data-featherlight]').featherlight();
$('.contest-tag').find('a[data-featherlight]').featherlight();
$('.join-warning').click(function () {
return confirm('{{ _('Are you sure you want to join?') }}\n' +
'{{ _('Joining a contest for the first time starts your timer, after which it becomes unstoppable.') }}');
});
$('.join-warning').click(function () {
return confirm('{{ _('Are you sure you want to join?') }}\n' +
'{{ _('Joining a contest for the first time starts your timer, after which it becomes unstoppable.') }}');
});
$('#search-org').select2({multiple: 1, placeholder: '{{ _('Groups') }}...'})
.css({'visibility': 'visible'});
$('#search-org').select2({multiple: 1, placeholder: '{{ _('Groups') }}...'})
.css({'visibility': 'visible'});
// var tooltip_classes = 'tooltipped tooltipped-e';
//
// $('.contest-tag').each(function () {
// var link = $(this);//
// link.mouseenter(function (e) {
// link.addClass(tooltip_classes).attr('aria-label', link.attr('data-description'));
// }).mouseleave(function (e) {
// link.removeClass(tooltip_classes).removeAttr('aria-label');
// });
// });
});
</script>
// var tooltip_classes = 'tooltipped tooltipped-e';
//
// $('.contest-tag').each(function () {
// var link = $(this);//
// link.mouseenter(function (e) {
// link.addClass(tooltip_classes).attr('aria-label', link.attr('data-description'));
// }).mouseleave(function (e) {
// link.removeClass(tooltip_classes).removeAttr('aria-label');
// });
// });
});
</script>
{% endblock %}
{% block left_sidebar %}
{% include "contest/contest-list-tabs.html" %}
{% include "contest/contest-list-tabs.html" %}
{% endblock %}
{% macro contest_head(contest) %}
{% spaceless %}
<a href="{{ url('contest_view', contest.key) }}" class="contest-list-title">
{{- contest.name -}}
</a>
<span class="contest-tags">
{% if not contest.is_visible %}
<span class="contest-tag contest-tag-hidden">
<i class="fa fa-eye-slash"></i> {{ _('hidden') }}
</span>
{% endif %}
{% if contest.is_editable %}
<span class="contest-tag contest-tag-edit">
<a href="{{ url('organization_contest_edit', organization.id, organization.slug, contest.key) }}" class="white">
<i class="fa fa-edit"></i> {{ _('Edit') }}
</a>
</span>
{% endif %}
{% if contest.is_private %}
<span class="contest-tag contest-tag-private">
<i class="fa fa-lock"></i> {{ _('private') }}
</span>
{% endif %}
{% if not hide_contest_orgs %}
{% if contest.is_organization_private %}
{% for org in contest.organizations.all() %}
<span class="contest-tag contest-tag-org">
<a href="{{ org.get_absolute_url() }}">
<i class="fa fa-lock"></i> {{ org.name }}
</a>
</span>
{% endfor %}
{% endif %}
{% endif %}
{% if contest.is_rated %}
<span class="contest-tag-rated">
<i class="fa fa-bar-chart"></i> {{ _('rated') }}
</span>
{% endif %}
{% for tag in contest.tags.all() %}
<span style="background-color: {{ tag.color }}" class="contest-tag">
<a href="{{ url('contest_tag', tag.name) }}"
style="color: {{ tag.text_color }}"
data-featherlight="{{ url('contest_tag_ajax', tag.name) }}">
{{- tag.name -}}
</a>
</span>
{% endfor %}
{% spaceless %}
<a href="{{ url('contest_view', contest.key) }}" class="contest-list-title">
{{- contest.name -}}
</a>
<span class="contest-tags">
{% if not contest.is_visible %}
<span class="contest-tag contest-tag-hidden">
<i class="fa fa-eye-slash"></i> {{ _('hidden') }}
</span>
{% endspaceless %}
{% endif %}
{% if contest.is_editable %}
<span class="contest-tag contest-tag-edit">
<a href="{{ url('organization_contest_edit', organization.id, organization.slug, contest.key) }}" class="white">
<i class="fa fa-edit"></i> {{ _('Edit') }}
</a>
</span>
{% endif %}
{% if contest.is_private %}
<span class="contest-tag contest-tag-private">
<i class="fa fa-lock"></i> {{ _('private') }}
</span>
{% endif %}
{% if not hide_contest_orgs %}
{% if contest.is_organization_private %}
{% for org in contest.organizations.all() %}
<span class="contest-tag contest-tag-org">
<a href="{{ org.get_absolute_url() }}">
<i class="fa fa-lock"></i> {{ org.name }}
</a>
</span>
{% endfor %}
{% endif %}
{% endif %}
{% if contest.is_rated %}
<span class="contest-tag-rated">
<i class="fa fa-bar-chart"></i> {{ _('rated') }}
</span>
{% endif %}
{% for tag in contest.tags.all() %}
<span style="background-color: {{ tag.color }}" class="contest-tag">
<a href="{{ url('contest_tag', tag.name) }}"
style="color: {{ tag.text_color }}"
data-featherlight="{{ url('contest_tag_ajax', tag.name) }}">
{{- tag.name -}}
</a>
</span>
{% endfor %}
</span>
{% endspaceless %}
{% endmacro %}
{% macro time_left(contest) %}
<div class="time time-left">
{% if contest.time_limit %}
{{ contest.start_time|date(_("M j, Y, G:i")) }} -
{{ contest.end_time|date(_("M j, Y, G:i")) }}
{% else %}
{{ contest.start_time|date(_("M j, Y, G:i")) }}
{% endif %}
<br>
{% if contest.time_limit %}
{% trans time_limit=contest.time_limit|timedelta('localized-no-seconds') %}{{ time_limit }} window{% endtrans %}
{% else %}
{% trans duration=contest.contest_window_length|timedelta('localized-no-seconds') %}{{ duration }} long{% endtrans %}
{% endif %}
</div>
<div class="time time-left">
{% if contest.time_limit %}
{{ contest.start_time|date(_("M j, Y, G:i")) }} -
{{ contest.end_time|date(_("M j, Y, G:i")) }}
{% else %}
{{ contest.start_time|date(_("M j, Y, G:i")) }}
{% endif %}
<br>
{% if contest.time_limit %}
{% trans time_limit=contest.time_limit|timedelta('localized-no-seconds') %}{{ time_limit }} window{% endtrans %}
{% else %}
{% trans duration=contest.contest_window_length|timedelta('localized-no-seconds') %}{{ duration }} long{% endtrans %}
{% endif %}
</div>
{% endmacro %}
{% macro user_count(contest, user) %}
{% if contest.can_see_own_scoreboard(user) %}
<a href="{{ url('contest_ranking', contest.key) }}">{{ contest.user_count }}</a>
{% else %}
{{ contest.user_count }}
{% endif %}
{% if contest.can_see_own_scoreboard(user) %}
<a href="{{ url('contest_ranking', contest.key) }}">{{ contest.user_count }}</a>
{% else %}
{{ contest.user_count }}
{% endif %}
{% endmacro %}
{% macro contest_join(contest, request) %}
{% if not request.in_contest %}
<td>
{% if request.profile in contest.authors.all() or request.profile in contest.curators.all() or request.profile in contest.testers.all() %}
<form action="{{ url('contest_join', contest.key) }}" method="post">
{% csrf_token %}
<input type="submit" class="unselectable button full small"
value="{{ _('Spectate') }}">
</form>
{% else %}
<form action="{{ url('contest_join', contest.key) }}" method="post">
{% csrf_token %}
<input type="submit" class="unselectable button full small join-warning"
value="{{ _('Join') }}">
</form>
{% endif %}
</td>
{% endif %}
{% if not request.in_contest %}
<td>
{% if request.profile in contest.authors.all() or request.profile in contest.curators.all() or request.profile in contest.testers.all() %}
<form action="{{ url('contest_join', contest.key) }}" method="post">
{% csrf_token %}
<input type="submit" class="unselectable button full small"
value="{{ _('Spectate') }}">
</form>
{% else %}
<form action="{{ url('contest_join', contest.key) }}" method="post">
{% csrf_token %}
<input type="submit" class="unselectable button full small join-warning"
value="{{ _('Join') }}">
</form>
{% endif %}
</td>
{% endif %}
{% endmacro %}
{% block middle_content %}
<div class="content-description">
<form id="filter-form">
<input id="search-contest" type="text" name="contest" value="{{ contest_query or '' }}"
placeholder="{{ _('Search contests...') }}">
{% if organizations %}
<select id="search-org" name="orgs" multiple>
{% for org in organizations %}
<option value="{{ org.id }}"{% if org.id in org_query %} selected{% endif %}>
{{ org.name }}
</option>
{% endfor %}
</select>
{% endif %}
<button id="search-btn" class="btn-green small"> {{ _('Search')}} </button>
{% if create_url %}
<a href="{{create_url}}" class="button small" style="float: right"><i class="fa fa-plus"></i> {{ _('Create')}}</a>
{% endif %}
</form>
{% if active_participations %}
<h3 class="toggle open contest-group-header">
<i class="fa fa-chevron-right fa-fw"></i>
{{ _('Active Contests') }}
</h3>
<div class="toggled">
<table class="contest-list table striped">
<thead>
<tr>
<th style="width:90%">{{ _('Contest') }}</th>
<th>{{ _('Users') }}</th>
{% if not request.in_contest %}
<th style="width:15%"></th>
{% endif %}
</tr>
</thead>
<tbody>
{% for participation in active_participations %}
{% with contest=participation.contest %}
<tr>
<td>
<div class="contest-block">
{{ contest_head(contest) }}
{% if contest.start_time %}
<br>
{% if contest.time_limit %}
<span class="time">
{% trans countdown=participation.end_time|as_countdown %}Window ends in {{countdown}}{% endtrans %}
</span>
{% elif contest.time_before_end %}
<span class="time">{% trans countdown=contest.end_time|as_countdown %}Ends in {{countdown}}{% endtrans %}</span>
{% endif %}
{{ time_left(contest) }}
{% endif %}
</div>
</td>
<td>
{{ user_count(contest, request.user) }}
</td>
{{ contest_join(contest, request) }}
</tr>
{% endwith %}
{% endfor %}
</tbody>
</table>
</div>
<br>
{% endif %}
{% if current_contests %}
<h3 class="toggle open contest-group-header">
<i class="fa fa-chevron-right fa-fw"></i>
{{ _('Ongoing Contests') }}
</h3>
<div id="ongoing-table" class="toggled">
<table class="contest-list table striped">
<thead>
<tr>
<th style="width:90%">{{ _('Contest') }}</th>
<th>{{ _('Users') }}</th>
{% if not request.in_contest %}
<th style="width:15%"></th>
{% endif %}
</tr>
</thead>
<tbody>
{% for contest in current_contests %}
<tr>
<td>
<div class="contest-block">
{{ contest_head(contest) }}
{% if contest.start_time %}
<br>
{% if contest.time_before_end %}
<span class="time">{% trans countdown=contest.end_time|as_countdown %}Ends in {{countdown}}{% endtrans %}</span>
{% endif %}
{{ time_left(contest) }}
{% endif %}
</div>
</td>
<td>
{{ user_count(contest, request.user) }}
</td>
{{ contest_join(contest, request) }}
</tr>
{% endfor %}
</tbody>
</table>
<br>
</div>
{% endif %}
<h3 class="toggle open contest-group-header">
<i class="fa fa-chevron-right fa-fw"></i>
{{ _('Upcoming Contests') }}
</h3>
{% if future_contests %}
<div class="toggled">
<table class="contest-list table striped">
<thead>
<tr>
<th>{{ _('Contest') }}</th>
</tr>
</thead>
<tbody>
{% for contest in future_contests %}
<tr>
<td>
<div class="contest-block">
{{ contest_head(contest) }}
{% if contest.start_time %}
<br>
{% if contest.time_before_start %}
<span class="time">{{ _('Starting in %(countdown)s.', countdown=contest.start_time|as_countdown) }}</span>
{% endif %}
{{ time_left(contest) }}
{% endif %}
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<i>{{ _('There are no scheduled contests at this time.') }}</i>
<br>
{% endif %}
<br>
{% if past_contests %}
<h3 class="contest-group-header">{{ _('Past Contests') }}</h3>
{% if page_obj and page_obj.num_pages > 1 %}
<div style="margin-bottom: 4px;">
{% include "list-pages.html" %}
</div>
{% endif %}
<table class="contest-list table striped">
<thead>
<div class="content-description">
<form id="filter-form">
<input id="search-contest" type="text" name="contest" value="{{ contest_query or '' }}"
placeholder="{{ _('Search contests...') }}">
{% if organizations %}
<select id="search-org" name="orgs" multiple>
{% for org in organizations %}
<option value="{{ org.id }}"{% if org.id in org_query %} selected{% endif %}>
{{ org.name }}
</option>
{% endfor %}
</select>
{% endif %}
<button id="search-btn" class="btn-green small"> {{ _('Search')}} </button>
{% if create_url %}
<a href="{{create_url}}" class="button small" style="float: right"><i class="fa fa-plus"></i> {{ _('Create')}}</a>
{% endif %}
</form>
{% if active_participations %}
<h3 class="toggle open contest-group-header">
<i class="fa fa-chevron-right fa-fw"></i>
{{ _('Active Contests') }}
</h3>
<div class="toggled">
<table class="contest-list table striped">
<thead>
<tr>
<th style="width:90%">{{ _('Contest') }}</th>
<th>{{ _('Users') }}</th>
{% if not request.in_contest %}
<th style="width:15%"></th>
{% endif %}
</tr>
</thead>
<tbody>
{% for participation in active_participations %}
{% with contest=participation.contest %}
<tr>
<th style="width:90%">
<a class="contest-list-sort" href="{{ sort_links.name }}">{{ _('Contest') }}{{ sort_order.name }}</a>
</th>
<th>
<a class="contest-list-sort" href="{{ sort_links.user_count }}">{{ _('Users') }}{{ sort_order.user_count }}</a>
</th>
{% if not request.in_contest %}
<th style="width:15%"></th>
{% endif %}
</tr>
</thead>
<tbody>
{% for contest in past_contests %}
<tr>
<td>
<div class="contest-block">
{{ contest_head(contest) }}
{{ time_left(contest) }}
</div>
</td>
<td>
{{ user_count(contest, request.user) }}
</td>
{% if not request.in_contest %}
<td><form action="{{ url('contest_join', contest.key) }}" method="post">
{% csrf_token %}
<input type="submit" class="unselectable button full small"
value="{{ _('Virtual join') }}">
</form>
</td>
<td>
<div class="contest-block">
{{ contest_head(contest) }}
{% if contest.start_time %}
<br>
{% if contest.time_limit %}
<span class="time">
{% trans countdown=participation.end_time|as_countdown %}Window ends in {{countdown}}{% endtrans %}
</span>
{% elif contest.time_before_end %}
<span class="time">{% trans countdown=contest.end_time|as_countdown %}Ends in {{countdown}}{% endtrans %}</span>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
{% if page_obj and page_obj.num_pages > 1 %}
<div style="margin-top: 10px;">
{% include "list-pages.html" %}
</div>
{{ time_left(contest) }}
{% endif %}
</div>
</td>
<td>
{{ user_count(contest, request.user) }}
</td>
{{ contest_join(contest, request) }}
</tr>
{% endwith %}
{% endfor %}
</tbody>
</table>
</div>
<br>
{% endif %}
{% if current_contests %}
<h3 class="toggle open contest-group-header">
<i class="fa fa-chevron-right fa-fw"></i>
{{ _('Ongoing Contests') }}
</h3>
<div id="ongoing-table" class="toggled">
<table class="contest-list table striped">
<thead>
<tr>
<th style="width:90%">{{ _('Contest') }}</th>
<th>{{ _('Users') }}</th>
{% if not request.in_contest %}
<th style="width:15%"></th>
{% endif %}
</tr>
</thead>
<tbody>
{% for contest in current_contests %}
<tr>
<td>
<div class="contest-block">
{{ contest_head(contest) }}
{% if contest.start_time %}
<br>
{% if contest.time_before_end %}
<span class="time">{% trans countdown=contest.end_time|as_countdown %}Ends in {{countdown}}{% endtrans %}</span>
{% endif %}
{{ time_left(contest) }}
{% endif %}
</div>
</td>
<td>
{{ user_count(contest, request.user) }}
</td>
{{ contest_join(contest, request) }}
</tr>
{% endfor %}
</tbody>
</table>
<br>
</div>
{% endif %}
<h3 class="toggle open contest-group-header">
<i class="fa fa-chevron-right fa-fw"></i>
{{ _('Upcoming Contests') }}
</h3>
{% if future_contests %}
<div class="toggled">
<table class="contest-list table striped">
<thead>
<tr>
<th>{{ _('Contest') }}</th>
</tr>
</thead>
<tbody>
{% for contest in future_contests %}
<tr>
<td>
<div class="contest-block">
{{ contest_head(contest) }}
{% if contest.start_time %}
<br>
{% if contest.time_before_start %}
<span class="time">{{ _('Starting in %(countdown)s.', countdown=contest.start_time|as_countdown) }}</span>
{% endif %}
{{ time_left(contest) }}
{% endif %}
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<i>{{ _('There are no scheduled contests at this time.') }}</i>
<br>
{% endif %}
<br>
{% if past_contests %}
<h3 class="contest-group-header">{{ _('Past Contests') }}</h3>
{% if page_obj and page_obj.num_pages > 1 %}
<div style="margin-bottom: 4px;">
{% include "list-pages.html" %}
</div>
{% endif %}
<table class="contest-list table striped">
<thead>
<tr>
<th style="width:90%">
<a class="contest-list-sort" href="{{ sort_links.name }}">{{ _('Contest') }}{{ sort_order.name }}</a>
</th>
<th>
<a class="contest-list-sort" href="{{ sort_links.user_count }}">{{ _('Users') }}{{ sort_order.user_count }}</a>
</th>
{% if not request.in_contest %}
<th style="width:15%"></th>
{% endif %}
{% endif %}
</div>
</tr>
</thead>
<tbody>
{% for contest in past_contests %}
<tr>
<td>
<div class="contest-block">
{{ contest_head(contest) }}
{{ time_left(contest) }}
</div>
</td>
<td>
{{ user_count(contest, request.user) }}
</td>
{% if not request.in_contest %}
<td><form action="{{ url('contest_join', contest.key) }}" method="post">
{% csrf_token %}
<input type="submit" class="unselectable button full small"
value="{{ _('Virtual join') }}">
</form>
</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
{% if page_obj and page_obj.num_pages > 1 %}
<div style="margin-top: 10px;">
{% include "list-pages.html" %}
</div>
{% endif %}
{% endif %}
</div>
{% endblock %}

View file

@ -1,212 +1,212 @@
<script src="//cdn.jsdelivr.net/npm/featherlight@1.7.14/release/featherlight.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
function isFaster(time1, time2) {
let arr1 = time1.split(':');
let arr2 = time2.split(':');
function isFaster(time1, time2) {
let arr1 = time1.split(':');
let arr2 = time2.split(':');
for (let i in arr1) {
let val1 = parseInt(arr1[i]);
let val2 = parseInt(arr2[i]);
if (val1 < val2) return true;
if (val1 > val2) return false;
}
return false;
for (let i in arr1) {
let val1 = parseInt(arr1[i]);
let val2 = parseInt(arr2[i]);
if (val1 < val2) return true;
if (val1 > val2) return false;
}
return false;
}
function scoretimeComparison(sub1, sub2) {
if (!sub2) return true;
return sub1['score'] > sub2['score'] || (sub1['score'] === sub2['score'] && isFaster(sub1['time'], sub2['time']));
}
function scoretimeComparison(sub1, sub2) {
if (!sub2) return true;
return sub1['score'] > sub2['score'] || (sub1['score'] === sub2['score'] && isFaster(sub1['time'], sub2['time']));
}
function highlightFirstSolve() {
// bucket to store submissions by problems
let bestSubmissions = {};
function highlightFirstSolve() {
// bucket to store submissions by problems
let bestSubmissions = {};
// get information
$('td a').each(function() {
var td = $(this)[0];
var link = $(this).attr('data-featherlight');
if (link && link.includes('submissions')) {
let scoreAndTime = (td.innerText.split('\n'))
let linkElements = link.split('/')
// get information
$('td a').each(function() {
var td = $(this)[0];
var link = $(this).attr('data-featherlight');
if (link && link.includes('submissions')) {
let scoreAndTime = (td.innerText.split('\n'))
let linkElements = link.split('/')
let problem = linkElements[linkElements.length - 2];
let score = parseFloat(scoreAndTime[0].replace(',', '.'));
let time = scoreAndTime[1];
// get information
let problem = linkElements[linkElements.length - 2];
let score = parseFloat(scoreAndTime[0].replace(',', '.'));
let time = scoreAndTime[1];
if (time) {
let curSubmission = {
'td': $(this).parent(),
'score': score,
'time': time
}
if (time) {
let curSubmission = {
'td': $(this).parent(),
'score': score,
'time': time
}
// update best submissions
let curBest = bestSubmissions[problem]
// update best submissions
let curBest = bestSubmissions[problem]
if (scoretimeComparison(curSubmission, curBest) && score) {
bestSubmissions[problem] = curSubmission;
}
}
}
})
for (let problem in bestSubmissions) {
bestSubmissions[problem]['td'].addClass('first-solve')
if (scoretimeComparison(curSubmission, curBest) && score) {
bestSubmissions[problem] = curSubmission;
}
}
}
})
for (let problem in bestSubmissions) {
bestSubmissions[problem]['td'].addClass('first-solve')
}
}
function renew_filter(need_update=true) {
var checkboxes = [
'#show-schools-checkbox',
'#show-fullnames-checkbox',
'#show-total-score-checkbox',
];
var checkboxes2 = [
'#show-friends-checkbox',
'#show-virtual-checkbox'
]
for (var i of checkboxes) {
var $box = $(i);
if ($box.is(':checked')) {
$box.prop('checked', false);
$box.click();
$box.prop('checked', true);
}
}
function renew_filter(need_update=true) {
var checkboxes = [
'#show-schools-checkbox',
'#show-fullnames-checkbox',
'#show-total-score-checkbox',
];
var checkboxes2 = [
'#show-friends-checkbox',
'#show-virtual-checkbox'
]
for (var i of checkboxes) {
var $box = $(i);
if ($box.is(':checked')) {
$box.prop('checked', false);
$box.click();
$box.prop('checked', true);
}
}
var to_update = false;
for (var i of checkboxes2) {
var $box = $(i);
if ($box.is(':checked')) {
to_update = true;
}
}
if (to_update && need_update) {
update_ranking();
}
var to_update = false;
for (var i of checkboxes2) {
var $box = $(i);
if ($box.is(':checked')) {
to_update = true;
}
}
function get_initial_rank() {
var ranks = $('.rank-td').map(function() {return this.innerHTML}).get();
var usernames = $('.user-name .rating a').map(function() {return this.text}).get();
window.user_rank = new Map();
for (var i = 0; i < ranks.length; i++) {
window.user_rank[usernames[i]] = ranks[i];
}
if (to_update && need_update) {
update_ranking();
}
}
function add_initial_friend_rank() {
var usernames = $('.user-name .rating a').map(function() {return this.text}).get();
var is_virtual = [];
$('.user-name').each(function() {
if($(this).children('sub').length) {
is_virtual.push(1);
}
else is_virtual.push(0);
});
$('.rank-td').each(function(i) {
if (!is_virtual[i]) this.innerHTML += ' (' + window.user_rank[usernames[i]] + ')';
});
function get_initial_rank() {
var ranks = $('.rank-td').map(function() {return this.innerHTML}).get();
var usernames = $('.user-name .rating a').map(function() {return this.text}).get();
window.user_rank = new Map();
for (var i = 0; i < ranks.length; i++) {
window.user_rank[usernames[i]] = ranks[i];
}
}
function update_ranking() {
var friend = $('#show-friends-checkbox').is(':checked');
var virtual = $('#show-virtual-checkbox').is(':checked');
$('#loading-gif').show();
var url = `{{url('contest_ranking_ajax', contest.key)}}?friend=${friend}&virtual=${virtual}`;
{% if page_type == 'final_ranking' %}
url += "&final=true";
{% endif %}
$.get({
url: url,
success: function(HTML) {
$('#users-table').html(HTML);
highlightFirstSolve();
renew_filter(false);
$('#loading-gif').hide();
if (!virtual && !friend) {
get_initial_rank();
}
if (friend) {
add_initial_friend_rank();
}
},
fail: function() {
console.log('Fail to update ranking');
}
});
}
function add_initial_friend_rank() {
var usernames = $('.user-name .rating a').map(function() {return this.text}).get();
$(function () {
$('.leaving-forever').click(function () {
return confirm('{{ _('Are you sure you want to leave?') }}\n' +
'{{ _('You cannot come back to a virtual participation. You will have to start a new one.') }}');
});
$('.first-join').click(function () {
return confirm('{{ _('Are you sure you want to join?') }}\n' +
'{{ _('Joining a contest starts your timer, after which it becomes unstoppable.') }}');
});
var url = '{{ url('contest_participation', contest.key, '__username__') }}';
var placeholder = $('#search-contest').replaceWith($('<select>').attr({
id: 'search-contest'
})).attr('placeholder');
$('#search-contest').select2({
placeholder: placeholder,
ajax: {
url: '{{ url('contest_user_search_select2_ajax', contest.key) }}'
},
minimumInputLength: 1,
escapeMarkup: function (markup) {
return markup;
},
templateResult: function (data, container) {
return ('<img class="user-search-image" src="' + data.gravatar_url + '" width="24" height="24">' +
'<span class="' + data.display_rank + ' user-search-name">' + data.text + '</span>');
}
}).on('change', function () {
window.location.href = url.replace('__username__', $(this).val());
});
$('#show-schools-checkbox').click(function () {
$('.school').toggle();
});
$('#show-fullnames-checkbox').click(function () {
$('.fullname').toggle();
});
{% if request.user.is_authenticated %}
$('#show-friends-checkbox').click(function() {
update_ranking();
})
{% endif %}
$('#show-virtual-checkbox').click(function() {
update_ranking();
})
$('#show-total-score-checkbox').click(function() {
$('.problem-score-col').toggle();
})
highlightFirstSolve();
renew_filter();
get_initial_rank();
{% if participation_tab %}
$('#show-virtual-checkbox').hide();
$('#show-virtual-label').hide();
{% else %}
{% if request.in_contest %}
clearInterval(window.rankingInterval);
window.rankingInterval = setInterval(update_ranking, 60 * 1000);
{% endif %}
{% endif %}
var is_virtual = [];
$('.user-name').each(function() {
if($(this).children('sub').length) {
is_virtual.push(1);
}
else is_virtual.push(0);
});
$('.rank-td').each(function(i) {
if (!is_virtual[i]) this.innerHTML += ' (' + window.user_rank[usernames[i]] + ')';
});
}
function update_ranking() {
var friend = $('#show-friends-checkbox').is(':checked');
var virtual = $('#show-virtual-checkbox').is(':checked');
$('#loading-gif').show();
var url = `{{url('contest_ranking_ajax', contest.key)}}?friend=${friend}&virtual=${virtual}`;
{% if page_type == 'final_ranking' %}
url += "&final=true";
{% endif %}
$.get({
url: url,
success: function(HTML) {
$('#users-table').html(HTML);
highlightFirstSolve();
renew_filter(false);
$('#loading-gif').hide();
if (!virtual && !friend) {
get_initial_rank();
}
if (friend) {
add_initial_friend_rank();
}
},
fail: function() {
console.log('Fail to update ranking');
}
});
}
$(function () {
$('.leaving-forever').click(function () {
return confirm('{{ _('Are you sure you want to leave?') }}\n' +
'{{ _('You cannot come back to a virtual participation. You will have to start a new one.') }}');
});
$('.first-join').click(function () {
return confirm('{{ _('Are you sure you want to join?') }}\n' +
'{{ _('Joining a contest starts your timer, after which it becomes unstoppable.') }}');
});
var url = '{{ url('contest_participation', contest.key, '__username__') }}';
var placeholder = $('#search-contest').replaceWith($('<select>').attr({
id: 'search-contest'
})).attr('placeholder');
$('#search-contest').select2({
placeholder: placeholder,
ajax: {
url: '{{ url('contest_user_search_select2_ajax', contest.key) }}'
},
minimumInputLength: 1,
escapeMarkup: function (markup) {
return markup;
},
templateResult: function (data, container) {
return ('<img class="user-search-image" src="' + data.gravatar_url + '" width="24" height="24">' +
'<span class="' + data.display_rank + ' user-search-name">' + data.text + '</span>');
}
}).on('change', function () {
window.location.href = url.replace('__username__', $(this).val());
});
$('#show-schools-checkbox').click(function () {
$('.school').toggle();
});
$('#show-fullnames-checkbox').click(function () {
$('.fullname').toggle();
});
{% if request.user.is_authenticated %}
$('#show-friends-checkbox').click(function() {
update_ranking();
})
{% endif %}
$('#show-virtual-checkbox').click(function() {
update_ranking();
})
$('#show-total-score-checkbox').click(function() {
$('.problem-score-col').toggle();
})
highlightFirstSolve();
renew_filter();
get_initial_rank();
{% if participation_tab %}
$('#show-virtual-checkbox').hide();
$('#show-virtual-label').hide();
{% else %}
{% if request.in_contest %}
clearInterval(window.rankingInterval);
window.rankingInterval = setInterval(update_ranking, 60 * 1000);
{% endif %}
{% endif %}
});
</script>

View file

@ -1,85 +1,85 @@
{% extends "two-column-content.html" %}
{% set page_type = 'moss' %}
{% block left_sidebar %}
{% include "contest/contest-tabs.html" %}
{% include "contest/contest-tabs.html" %}
{% endblock %}
{% block two_col_media %}
<style>
.panes {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.pane {
padding: 20px;
}
</style>
<style>
.panes {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.pane {
padding: 20px;
}
</style>
{% endblock %}
{% block two_col_js %}
<script type="text/javascript">
$(function () {
$('.contest-moss').click(function () {
return confirm('{{ _('Are you sure you want MOSS the contest?') }}');
});
});
$(function () {
$('.contest-moss-delete').click(function () {
return confirm('{{ _('Are you sure you want to delete the MOSS results?') }}');
});
});
</script>
<script type="text/javascript">
$(function () {
$('.contest-moss').click(function () {
return confirm('{{ _('Are you sure you want MOSS the contest?') }}');
});
});
$(function () {
$('.contest-moss-delete').click(function () {
return confirm('{{ _('Are you sure you want to delete the MOSS results?') }}');
});
});
</script>
{% endblock %}
{% block middle_content %}
{% if has_results %}
<table class="table">
<thead>
<tr>
<th class="header">{{ _('Problem') }}</th>
{% for lang in languages %}
<th class="header">{{ lang }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for problem, results in moss_results %}
<tr id="problem-{{ problem.code }}">
<td>
<a href="{{ url('problem_detail', problem.code) }}">{{ problem.name }}</a>
</td>
{% for result in results %}
<td>
{% if result.submission_count %}
<a href="{{ result.url }}">{{ result.submission_count }} {{_('submissions')}}</a>
{% else %}
{{ _('No submissions') }}
{% endif %}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
<div class="panes">
<div class="pane">
<form method="post" action="{{ url('contest_moss', contest.key) }}">
{% csrf_token %}
<input type="submit" class="unselectable button full contest-moss" style="padding: 10px;"
value="{% if has_results %} {{ _('Re-MOSS contest') }} {% else %} {{ _('MOSS contest') }} {% endif %}">
</form>
</div>
{% if has_results %}
<div class="pane">
<form method="post" action="{{ url('contest_moss_delete', contest.key) }}">
{% csrf_token %}
<input type="submit" class="unselectable button full contest-moss-delete" style="padding: 10px;"
value="{{ _('Delete MOSS results') }}">
</form>
</div>
{% endif %}
{% if has_results %}
<table class="table">
<thead>
<tr>
<th class="header">{{ _('Problem') }}</th>
{% for lang in languages %}
<th class="header">{{ lang }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for problem, results in moss_results %}
<tr id="problem-{{ problem.code }}">
<td>
<a href="{{ url('problem_detail', problem.code) }}">{{ problem.name }}</a>
</td>
{% for result in results %}
<td>
{% if result.submission_count %}
<a href="{{ result.url }}">{{ result.submission_count }} {{_('submissions')}}</a>
{% else %}
{{ _('No submissions') }}
{% endif %}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
<div class="panes">
<div class="pane">
<form method="post" action="{{ url('contest_moss', contest.key) }}">
{% csrf_token %}
<input type="submit" class="unselectable button full contest-moss" style="padding: 10px;"
value="{% if has_results %} {{ _('Re-MOSS contest') }} {% else %} {{ _('MOSS contest') }} {% endif %}">
</form>
</div>
{% if has_results %}
<div class="pane">
<form method="post" action="{{ url('contest_moss_delete', contest.key) }}">
{% csrf_token %}
<input type="submit" class="unselectable button full contest-moss-delete" style="padding: 10px;"
value="{{ _('Delete MOSS results') }}">
</form>
</div>
{% endif %}
</div>
{% endblock %}

View file

@ -1,4 +1,4 @@
{{ preview_data|markdown|reference|str|safe }}
{% if REQUIRE_JAX %}
<div data-config="{{ static('mathjax3_config.js') }}" class="require-mathjax-support"></div>
<div data-config="{{ static('mathjax3_config.js') }}" class="require-mathjax-support"></div>
{% endif %}

View file

@ -1,20 +1,20 @@
{% extends "base.html" %}
{% block body %}
{% if error.is_private %}
<p><i>{{ _('This contest is private to specific users.') }}</i></p>
{% endif %}
{% if error.is_private %}
<p><i>{{ _('This contest is private to specific users.') }}</i></p>
{% endif %}
{% if error.is_organization_private %}
{% if error.is_private %}
<p>{{ _('Additionally, only the following organizations may access this contest:') }}</p>
{% else %}
<p>{{ _('Only the following organizations may access this contest:') }}</p>
{% endif %}
<ul>
{% for org in error.orgs %}
<li><a href="{{ org.get_absolute_url() }}">{{ org.name }}</a></li>
{% endfor %}
</ul>
{% if error.is_organization_private %}
{% if error.is_private %}
<p>{{ _('Additionally, only the following organizations may access this contest:') }}</p>
{% else %}
<p>{{ _('Only the following organizations may access this contest:') }}</p>
{% endif %}
<ul>
{% for org in error.orgs %}
<li><a href="{{ org.get_absolute_url() }}">{{ org.name }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% endblock %}

View file

@ -1,102 +1,102 @@
<style>
#users-table .username {
min-width: 15em;
}
#users-table td {
height: 2.5em;
}
#users-table a {
display: block;
}
.userinfo a, .user-name a, .user-name form {
display: inline !important;
}
#users-table td a:hover {
text-decoration: underline;
}
.rank {
min-width: 2.5em
}
.points {
min-width: 2.5em;
}
.start-time {
display: none;
}
.user-name {
position: relative;
padding-left: 2em !important;
}
.organization-column {
display: none;
text-align: left !important;
border-right: none !important;
}
.featherlight-content {
border-radius: 10px;
height: 80%;
width: 60%;
overflow: auto;
}
.select2-selection__arrow {
display: none;
}
.select2-selection__rendered {
cursor: text;
overflow: initial !important
}
.select2-results__option {
white-space: nowrap;
}
#search-contest, #search-contest + .select2 {
margin-top: 0.5em;
}
#search-contest {
width: 200px;
height: 2.3em;
}
html.with-featherlight {
overflow: unset;
}
@media (max-width: 799px) {
.featherlight-content {
width: 95%;
}
#users-table .username {
min-width: fit-content;
}
}
</style>
{% if has_rating %}
<style>#users-table .rate-box {
font-size: 0.85em;
float: left;
}
#users-table td:nth-child(1) .rating {
margin-left: 1.25em;
display: block;
}
#users-table td:nth-child(2) a {
display: block;
}
</style>
{% endif %}
<style>
#users-table .username {
min-width: 15em;
}
#users-table td {
height: 2.5em;
}
#users-table a {
display: block;
}
.userinfo a, .user-name a, .user-name form {
display: inline !important;
}
#users-table td a:hover {
text-decoration: underline;
}
.rank {
min-width: 2.5em
}
.points {
min-width: 2.5em;
}
.start-time {
display: none;
}
.user-name {
position: relative;
padding-left: 2em !important;
}
.organization-column {
display: none;
text-align: left !important;
border-right: none !important;
}
.featherlight-content {
border-radius: 10px;
height: 80%;
width: 60%;
overflow: auto;
}
.select2-selection__arrow {
display: none;
}
.select2-selection__rendered {
cursor: text;
overflow: initial !important
}
.select2-results__option {
white-space: nowrap;
}
#search-contest, #search-contest + .select2 {
margin-top: 0.5em;
}
#search-contest {
width: 200px;
height: 2.3em;
}
html.with-featherlight {
overflow: unset;
}
@media (max-width: 799px) {
.featherlight-content {
width: 95%;
}
#users-table .username {
min-width: fit-content;
}
}
</style>
{% if has_rating %}
<style>#users-table .rate-box {
font-size: 0.85em;
float: left;
}
#users-table td:nth-child(1) .rating {
margin-left: 1.25em;
display: block;
}
#users-table td:nth-child(2) a {
display: block;
}
</style>
{% endif %}

View file

@ -3,77 +3,77 @@
{% set friends = request.profile.get_friends() if request.user.is_authenticated else {} %}
{% block after_rank_head %}
{% if has_rating %}
<th class="rating-column">{{ _('Rating') }}</th>
{% endif %}
{% if has_rating %}
<th class="rating-column">{{ _('Rating') }}</th>
{% endif %}
{% endblock %}
{% block after_rank %}
{% if has_rating %}
<td class="rating-column">{% if user.participation_rating %}{{ rating_number(user.participation_rating) }}{% endif %}</td>
{% endif %}
{% if has_rating %}
<td class="rating-column">{% if user.participation_rating %}{{ rating_number(user.participation_rating) }}{% endif %}</td>
{% endif %}
{% endblock %}
{% block user_footer %}
{% if user.user.first_name %}
<div style="font-weight: 600; display: none" class="fullname gray">
{{ user.user.first_name if user.user.first_name else ''}}
</div>
{% endif %}
{% if user.user.last_name %}
<div class="school gray" style="display: none"><a style="font-weight: 600">
{{- user.user.last_name -}}
</a></div>
{% endif %}
{% if user.user.first_name %}
<div style="font-weight: 600; display: none" class="fullname gray">
{{ user.user.first_name if user.user.first_name else ''}}
</div>
{% endif %}
{% if user.user.last_name %}
<div class="school gray" style="display: none"><a style="font-weight: 600">
{{- user.user.last_name -}}
</a></div>
{% endif %}
{% endblock %}
{% block user_data %}
{% if user.participation.virtual %}
<sub class="gray">[{{user.participation.virtual}}]</sub>
{% endif %}
{% if can_edit %}
<span class="contest-participation-operation">
<form action="{{ url('contest_participation_disqualify', contest.key) }}" method="post">
{% csrf_token %}
<input type="hidden" name="participation" value="{{ user.participation.id }}">
{% if user.participation.is_disqualified %}
<a href="#" title="{{ _('Un-Disqualify') }}"
class="un-disqualify-participation"><i class="fa fa-undo fa-fw"></i></a>
{% else %}
<a href="#" title="{{ _('Disqualify') }}"
class="disqualify-participation"><i class="fa fa-trash fa-fw"></i></a>
{% endif %}
</form>
{% if perms.judge.change_contestparticipation %}
<a href="{{ url('admin:judge_contestparticipation_change', user.participation.id) }}"
title="{{ _('Admin') }}" class="edit-participation"><i class="fa fa-cog fa-fw"></i></a>
{% endif %}
</span>
{% endif %}
{% if user.participation.virtual %}
<sub class="gray">[{{user.participation.virtual}}]</sub>
{% endif %}
{% if can_edit %}
<span class="contest-participation-operation">
<form action="{{ url('contest_participation_disqualify', contest.key) }}" method="post">
{% csrf_token %}
<input type="hidden" name="participation" value="{{ user.participation.id }}">
{% if user.participation.is_disqualified %}
<a href="#" title="{{ _('Un-Disqualify') }}"
class="un-disqualify-participation"><i class="fa fa-undo fa-fw"></i></a>
{% else %}
<a href="#" title="{{ _('Disqualify') }}"
class="disqualify-participation"><i class="fa fa-trash fa-fw"></i></a>
{% endif %}
</form>
{% if perms.judge.change_contestparticipation %}
<a href="{{ url('admin:judge_contestparticipation_change', user.participation.id) }}"
title="{{ _('Admin') }}" class="edit-participation"><i class="fa fa-cog fa-fw"></i></a>
{% endif %}
</span>
{% endif %}
{% endblock %}
{% block before_point_head %}
<th class="full-name" style="display:none;">{{ _('Fullname') }}</th>
<th style="display:none;">{{ _('School') }}</th>
{% for problem in problems %}
<th class="points header problem-score-col" title="{{ problem.problem.name }}"><a href="{{ url('problem_detail', problem.problem.code) }}">
{{- contest.get_label_for_problem(loop.index0) }}
<div class="point-denominator">{{ problem.points }}</div>
<div class="problem-code" style="display: none;">{{ problem.problem.code }}</div>
</a></th>
{% endfor %}
<th class="full-name" style="display:none;">{{ _('Fullname') }}</th>
<th style="display:none;">{{ _('School') }}</th>
{% for problem in problems %}
<th class="points header problem-score-col" title="{{ problem.problem.name }}"><a href="{{ url('problem_detail', problem.problem.code) }}">
{{- contest.get_label_for_problem(loop.index0) }}
<div class="point-denominator">{{ problem.points }}</div>
<div class="problem-code" style="display: none;">{{ problem.problem.code }}</div>
</a></th>
{% endfor %}
{% endblock %}
{% block row_extra %}
class="{{ 'disqualified' if user.participation.is_disqualified }} {{'highlight' if user.username == request.user.username}}"
class="{{ 'disqualified' if user.participation.is_disqualified }} {{'highlight' if user.username == request.user.username}}"
{% endblock %}
{% block before_point %}
{% for cell in user.problem_cells %}
{{ cell }}
{% endfor %}
{% for cell in user.problem_cells %}
{{ cell }}
{% endfor %}
{% endblock %}
{% block point %}
{{ user.result_cell }}
{{ user.result_cell }}
{% endblock %}

View file

@ -1,160 +1,160 @@
{% extends "user/base-users-two-col.html" %}
{% block left_sidebar %}
{% include "contest/contest-tabs.html" %}
{% include "contest/contest-tabs.html" %}
{% endblock %}
{% block users_media %}
{% include "contest/ranking-css.html" %}
{% include "contest/ranking-css.html" %}
{% endblock %}
{% block users_js_media %}
{% if can_edit %}
<script type="text/javascript">
$(function () {
$('a.disqualify-participation').click(function (e) {
e.preventDefault();
if (e.ctrlKey || e.metaKey || confirm("{{ _('Are you sure you want to disqualify this participation?') }}"))
$(this).closest('form').submit();
})
$('a.un-disqualify-participation').click(function (e) {
e.preventDefault();
if (e.ctrlKey || e.metaKey || confirm("{{ _('Are you sure you want to un-disqualify this participation?') }}"))
$(this).closest('form').submit();
})
{% if can_edit %}
<script type="text/javascript">
$(function () {
$('a.disqualify-participation').click(function (e) {
e.preventDefault();
if (e.ctrlKey || e.metaKey || confirm("{{ _('Are you sure you want to disqualify this participation?') }}"))
$(this).closest('form').submit();
})
$('a.un-disqualify-participation').click(function (e) {
e.preventDefault();
if (e.ctrlKey || e.metaKey || confirm("{{ _('Are you sure you want to un-disqualify this participation?') }}"))
$(this).closest('form').submit();
})
});
</script>
{% endif %}
{% if perms.judge.change_contestparticipation %}
<script type="text/javascript">
$(function () {
$('td.user').find('a.user-name').click(function (e) {
var data = $(this).siblings('.edit-participation');
if (e.altKey && data.length) {
window.open(data.attr('data-link'), '_blank');
return false;
}
});
});
</script>
{% endif %}
{% if not contest.ended %}
<script type="text/javascript">
$(function () {
window.install_tooltips = function () {
$('td.user').find('a.user-name').each(function () {
var link = $(this);
link.mouseenter(function (e) {
var start_time = link.siblings('.start-time').text();
link.addClass('tooltipped tooltipped-e').attr('aria-label', start_time);
}).mouseleave(function (e) {
link.removeClass('tooltipped tooltipped-e').removeAttr('aria-label');
});
</script>
{% endif %}
{% if perms.judge.change_contestparticipation %}
<script type="text/javascript">
$(function () {
$('td.user').find('a.user-name').click(function (e) {
var data = $(this).siblings('.edit-participation');
if (e.altKey && data.length) {
window.open(data.attr('data-link'), '_blank');
return false;
}
});
});
</script>
{% endif %}
{% if not contest.ended %}
<script type="text/javascript">
$(function () {
window.install_tooltips = function () {
$('td.user').find('a.user-name').each(function () {
var link = $(this);
link.mouseenter(function (e) {
var start_time = link.siblings('.start-time').text();
link.addClass('tooltipped tooltipped-e').attr('aria-label', start_time);
}).mouseleave(function (e) {
link.removeClass('tooltipped tooltipped-e').removeAttr('aria-label');
});
});
};
});
};
install_tooltips();
});
</script>
{% endif %}
{% if page_type == 'ranking' or page_type == 'final_ranking' %}
<script type="text/javascript">
$.fn.ignore = function(sel) {
return this.clone().find(sel || '>*').remove().end();
};
install_tooltips();
});
</script>
{% endif %}
{% if page_type == 'ranking' or page_type == 'final_ranking' %}
<script type="text/javascript">
$.fn.ignore = function(sel) {
return this.clone().find(sel || '>*').remove().end();
};
function download_ranking_as_csv() {
function clean_text(text) {
// Remove new line and leading/trailing spaces
text = text.replace(/(\r\n|\n|\r)/gm, '').trim();
// Escape double-quote with double-double-quote
text = text.replace(/"/g, '""');
function download_ranking_as_csv() {
function clean_text(text) {
// Remove new line and leading/trailing spaces
text = text.replace(/(\r\n|\n|\r)/gm, '').trim();
// Escape double-quote with double-double-quote
text = text.replace(/"/g, '""');
return '"' + text + '"';
}
return '"' + text + '"';
}
var csv = [];
var csv = [];
$('table#users-table thead tr').each(function () {
var header = [];
$(this).find('th').each(function () {
var $col = $(this);
$('table#users-table thead tr').each(function () {
var header = [];
$(this).find('th').each(function () {
var $col = $(this);
if ($col.hasClass('rating-column')) {
return;
} else if ($col.hasClass('problem-score-col')) {
header.push(clean_text($col.find('.problem-code').text()));
} else {
header.push(clean_text($col.text()));
}
});
csv.push(header.join(','));
});
$('table#users-table tbody tr').each(function () {
var row_data = [];
$(this).find('td').each(function () {
var $col = $(this);
if ($col.hasClass('rating-column')) {
return;
} else if ($col.hasClass('user-name')) {
row_data.push(clean_text($col.ignore('.fullname').ignore('.school').text()));
row_data.push(clean_text($col.ignore('.user').ignore('.school').text()));
row_data.push(clean_text($col.ignore('.user').ignore('.fullname').text()));
} else {
row_data.push(clean_text($col.ignore('.solving-time').text()));
}
});
csv.push(row_data.join(','));
});
csv = csv.join('\n');
var filename = '{{ contest.key }}_' + moment().format('MMMM Do YYYY, h:mm:ss a'); + '.csv';
var link = document.createElement('a');
link.style.display = 'none';
link.setAttribute('target', '_blank');
link.setAttribute('href', 'data:text/csv;charset=utf-8,\uFEFF' + encodeURIComponent(csv));
link.setAttribute('download', filename);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
if ($col.hasClass('rating-column')) {
return;
} else if ($col.hasClass('problem-score-col')) {
header.push(clean_text($col.find('.problem-code').text()));
} else {
header.push(clean_text($col.text()));
}
</script>
{% endif %}
{% include "contest/media-js.html" %}
});
csv.push(header.join(','));
});
$('table#users-table tbody tr').each(function () {
var row_data = [];
$(this).find('td').each(function () {
var $col = $(this);
if ($col.hasClass('rating-column')) {
return;
} else if ($col.hasClass('user-name')) {
row_data.push(clean_text($col.ignore('.fullname').ignore('.school').text()));
row_data.push(clean_text($col.ignore('.user').ignore('.school').text()));
row_data.push(clean_text($col.ignore('.user').ignore('.fullname').text()));
} else {
row_data.push(clean_text($col.ignore('.solving-time').text()));
}
});
csv.push(row_data.join(','));
});
csv = csv.join('\n');
var filename = '{{ contest.key }}_' + moment().format('MMMM Do YYYY, h:mm:ss a'); + '.csv';
var link = document.createElement('a');
link.style.display = 'none';
link.setAttribute('target', '_blank');
link.setAttribute('href', 'data:text/csv;charset=utf-8,\uFEFF' + encodeURIComponent(csv));
link.setAttribute('download', filename);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
</script>
{% endif %}
{% include "contest/media-js.html" %}
{% endblock %}
{% block before_table %}
{% include "contest/contest-datetime.html" %}
<div style="margin-bottom: 0.5em">
{% if page_type == 'participation' %}
{% if contest.can_see_full_scoreboard(request.user) %}
<input id="search-contest" type="text" placeholder="{{ _('View user participation') }}">
{% endif %}
{% endif %}
<input id="show-schools-checkbox" type="checkbox" style="vertical-align: bottom">
<label for="show-schools-checkbox" style="vertical-align: bottom; margin-right: 1em;">{{ _('Show schools') }}</label>
<input id="show-fullnames-checkbox" type="checkbox" style="vertical-align: bottom">
{% include "contest/contest-datetime.html" %}
<div style="margin-bottom: 0.5em">
{% if page_type == 'participation' %}
{% if contest.can_see_full_scoreboard(request.user) %}
<input id="search-contest" type="text" placeholder="{{ _('View user participation') }}">
{% endif %}
{% endif %}
<input id="show-schools-checkbox" type="checkbox" style="vertical-align: bottom">
<label for="show-schools-checkbox" style="vertical-align: bottom; margin-right: 1em;">{{ _('Show schools') }}</label>
<label for="show-fullnames-checkbox" style="vertical-align: bottom; margin-right: 1em;">{{ _('Show full name') }}</label>
{% if request.user.is_authenticated %}
<input id="show-friends-checkbox" type="checkbox" style="vertical-align: bottom;">
<label for="show-friends-checkbox" style="vertical-align: bottom; margin-right: 1em;">{{ _('Show friends only') }}</label>
{% endif %}
<input id="show-total-score-checkbox" type="checkbox" style="vertical-align: bottom; ">
<label for="show-total-score-checkbox" style="vertical-align: bottom; margin-right: 1em;">{{ _('Total score only') }}</label>
<input id="show-virtual-checkbox" type="checkbox" style="vertical-align: bottom;">
<label id="show-virtual-label" for="show-virtual-checkbox" style="vertical-align: bottom; margin-right: 1em;">{{ _('Show virtual participation') }}</label>
<img src="{{static('loading.gif')}}" style="height: 1em; display:none;" id="loading-gif"></img>
<a href="#" onclick="download_ranking_as_csv()" style="float: right;">
<i class="fa fa-download" aria-hidden="true"></i>
{{ _('Download as CSV') }}
</a>
</div>
<input id="show-fullnames-checkbox" type="checkbox" style="vertical-align: bottom">
<label for="show-fullnames-checkbox" style="vertical-align: bottom; margin-right: 1em;">{{ _('Show full name') }}</label>
{% if request.user.is_authenticated %}
<input id="show-friends-checkbox" type="checkbox" style="vertical-align: bottom;">
<label for="show-friends-checkbox" style="vertical-align: bottom; margin-right: 1em;">{{ _('Show friends only') }}</label>
{% endif %}
<input id="show-total-score-checkbox" type="checkbox" style="vertical-align: bottom; ">
<label for="show-total-score-checkbox" style="vertical-align: bottom; margin-right: 1em;">{{ _('Total score only') }}</label>
<input id="show-virtual-checkbox" type="checkbox" style="vertical-align: bottom;">
<label id="show-virtual-label" for="show-virtual-checkbox" style="vertical-align: bottom; margin-right: 1em;">{{ _('Show virtual participation') }}</label>
<img src="{{static('loading.gif')}}" style="height: 1em; display:none;" id="loading-gif"></img>
<a href="#" onclick="download_ranking_as_csv()" style="float: right;">
<i class="fa fa-download" aria-hidden="true"></i>
{{ _('Download as CSV') }}
</a>
</div>
{% endblock %}
{% block users_table %}
{% include "contest/ranking-table.html" %}
{% include "contest/ranking-table.html" %}
{% endblock %}

View file

@ -2,82 +2,82 @@
{% set page_type = 'stats' %}
{% block left_sidebar %}
{% include "contest/contest-tabs.html" %}
{% include "contest/contest-tabs.html" %}
{% endblock %}
{% block two_col_js %}
<script type="text/javascript">
window.stats = {{ stats }};
</script>
{% compress js %}
{% include "stats/media-js.html" %}
<script type="text/javascript">
window.stats = {{ stats }};
</script>
{% compress js %}
{% include "stats/media-js.html" %}
<script type="text/javascript">
$(function () {
draw_stacked_bar_chart(window.stats.problem_status_count, $('#problem-status-count'));
draw_bar_chart(window.stats.problem_ac_rate, $('#problem-ac-rate'));
pts_hist = draw_histogram(window.stats.problem_point[0], $('#problem-point'));
draw_pie_chart(window.stats.language_count, $('#language-count'));
draw_bar_chart(window.stats.language_ac_rate, $('#language-ac-rate'));
$('#problem-point-select').change(function() {
pts_hist.destroy();
problem = $(this).val();
pts_hist = draw_histogram(window.stats.problem_point[problem],
$('#problem-point'));
})
$(function () {
draw_stacked_bar_chart(window.stats.problem_status_count, $('#problem-status-count'));
draw_bar_chart(window.stats.problem_ac_rate, $('#problem-ac-rate'));
pts_hist = draw_histogram(window.stats.problem_point[0], $('#problem-point'));
draw_pie_chart(window.stats.language_count, $('#language-count'));
draw_bar_chart(window.stats.language_ac_rate, $('#language-ac-rate'));
$('#problem-point-select').select2({
width: '10em',
});
});
</script>
{% endcompress %}
{% include "contest/media-js.html" %}
$('#problem-point-select').change(function() {
pts_hist.destroy();
problem = $(this).val();
pts_hist = draw_histogram(window.stats.problem_point[problem],
$('#problem-point'));
})
$('#problem-point-select').select2({
width: '10em',
});
});
</script>
{% endcompress %}
{% include "contest/media-js.html" %}
{% endblock %}
{% block two_col_media %}
<style>
.chart {
margin: 10px 0;
}
</style>
<style>
.chart {
margin: 10px 0;
}
</style>
{% endblock %}
{% block middle_content %}
<h3>{{ _('Problem Status Distribution') }}</h3>
<div id="problem-status-count" class="chart">
<canvas></canvas>
</div>
<h3>{{ _('Problem Status Distribution') }}</h3>
<div id="problem-status-count" class="chart">
<canvas></canvas>
</div>
<h3>{{ _('Problem AC Rate') }}</h3>
<div id="problem-ac-rate" class="chart">
<canvas></canvas>
</div>
<h3>
{{ _('Problem Point Distribution') }}:
<select id="problem-point-select">
{% for name in problems %}
<option value="{{ loop.index0 }}" class="point-dropdown">
{{ name }}
</option>
{% endfor %}
</select>
</h3>
<h3>{{ _('Problem AC Rate') }}</h3>
<div id="problem-ac-rate" class="chart">
<canvas></canvas>
</div>
<div id="problem-point" class="chart">
<canvas></canvas>
</div>
<h3>
{{ _('Problem Point Distribution') }}:
<select id="problem-point-select">
{% for name in problems %}
<option value="{{ loop.index0 }}" class="point-dropdown">
{{ name }}
</option>
{% endfor %}
</select>
</h3>
<h3>{{ _('Submissions by Language') }}</h3>
<div id="language-count" class="chart">
<canvas width="400" height="300"></canvas>
<ul class="legend"></ul>
</div>
<div id="problem-point" class="chart">
<canvas></canvas>
</div>
<h3>{{ _('Language AC Rate') }}</h3>
<div id="language-ac-rate" class="chart">
<canvas></canvas>
</div>
<h3>{{ _('Submissions by Language') }}</h3>
<div id="language-count" class="chart">
<canvas width="400" height="300"></canvas>
<ul class="legend"></ul>
</div>
<h3>{{ _('Language AC Rate') }}</h3>
<div id="language-ac-rate" class="chart">
<canvas></canvas>
</div>
{% endblock %}

View file

@ -1,7 +1,7 @@
{% if not title %}
{% include "contest/tag-title.html" %}
<br><br>
<hr>
{% include "contest/tag-title.html" %}
<br><br>
<hr>
{% endif %}
{{ tag.description|markdown }}

View file

@ -1,11 +1,11 @@
<h2 style="display:inline">
<span style="background-color: {{ tag.color }}; color: {{ tag.text_color }}" class="contest-tag">
{{- tag.name -}}
</span>
<span style="background-color: {{ tag.color }}; color: {{ tag.text_color }}" class="contest-tag">
{{- tag.name -}}
</span>
</h2>
{% if perms.judge.change_contesttag %}
<div class="title-line-action">
[<a href="{{ url('admin:judge_contesttag_change', tag.id) }}">{{ _('Edit') }}</a>]
</div>
<div class="title-line-action">
[<a href="{{ url('admin:judge_contesttag_change', tag.id) }}">{{ _('Edit') }}</a>]
</div>
{% endif %}

View file

@ -1,9 +1,9 @@
{% extends "base.html" %}
{% block content_title %}
{% include "contest/tag-title.html" %}
{% include "contest/tag-title.html" %}
{% endblock %}
{% block body %}
{% include "contest/tag-ajax.html" %}
{% include "contest/tag-ajax.html" %}
{% endblock %}