Rewrite contest UI

This commit is contained in:
cuom1999 2022-11-27 01:03:38 -06:00
parent 6c9551e089
commit 756023a097
20 changed files with 191 additions and 254 deletions

View file

@ -1,78 +1,24 @@
{% extends "common-content.html" %}
{% block title_ruler %}{% endblock %}
{% block title_row %}
{% set tab = 'detail' %}
{% extends "two-column-content.html" %}
{% set page_type = 'detail' %}
{% block left_sidebar %}
{% set title = contest.name %}
{% include "contest/contest-tabs.html" %}
{% endblock %}
{% block content_js_media %}
<script type="text/javascript">
$(document).ready(function () {
$('.time-remaining').each(function () {
count_down($(this));
});
});
</script>
{% block two_col_js %}
{% include "contest/media-js.html" %}
{% include "comments/media-js.html" %}
{% include "actionbar/media-js.html" %}
{% endblock %}
{% block content_media %}
{% block two_col_media %}
{% include "comments/media-css.html" %}
{% include "actionbar/media-css.html" %}
{% endblock %}
{% block body %}
<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>
{% block middle_content %}
{% include "contest/contest-datetime.html" %}
<div class="content-description">
{% cache 3600 'contest_html' contest.id MATH_ENGINE %}
@ -128,12 +74,4 @@
{% include "actionbar/list.html" %}
<br>
{% include "comments/list.html" %}
{% endblock %}
{% block description_end %}{% endblock %}
{% block bodyend %}
{{ super() }}
{% include "comments/math.html" %}
{% endblock %}
k
{% endblock %}