{% extends "two-column-content.html" %} {% block meta %} {% endblock %} {% block two_col_media %} {% endblock %} {% block two_col_js %} {% endblock %} {% block left_sidebar %} {% include "contest/contest-list-tabs.html" %} {% endblock %} {% macro contest_head(contest) %} {% spaceless %} {{- contest.name -}}
{% if not contest.is_visible %} {{ _('hidden') }} {% endif %} {% if contest.is_editable %} {{ _('Edit') }} {% endif %} {% if contest.is_private %} {{ _('private') }} {% endif %} {% if not hide_contest_orgs %} {% if contest.is_organization_private %} {% for org in contest.organizations.all() %} {{ org.name }} {% endfor %} {% endif %} {% endif %} {% if contest.is_rated %} {{ _('rated') }} {% endif %} {% for tag in contest.tags.all() %} {{- tag.name -}} {% endfor %}
{% endspaceless %} {% endmacro %} {% macro time_left(contest, padding_top = true) %}
{% 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 %}
{% 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 %}
{% endmacro %} {% macro user_count(contest, user) %} {% if contest.can_see_own_scoreboard(user) %} {{ contest.user_count }} {% else %} {{ contest.user_count }} {% endif %} {% endmacro %} {% macro contest_join(contest, request) %} {% if not request.in_contest %} {% if request.profile in contest.authors.all() or request.profile in contest.curators.all() or request.profile in contest.testers.all() %}
{% csrf_token %}
{% else %}
{% csrf_token %}
{% endif %} {% endif %} {% endmacro %} {% block middle_content %}
{% if organizations %} {% endif %} {% if organizations %}
{% endif %} {% if create_url %} {{ _('Create')}} {% endif %}
{% if active_participations %}

{{ _('Active Contests') }}

{% for participation in active_participations %} {% with contest=participation.contest %}
{{ _('Contests') }}
{{ contest_head(contest) }}
{{ _('Time') }}
{% if contest.start_time %} {% if contest.time_limit %} {% trans countdown=participation.end_time|as_countdown %}Window ends in {{countdown}}{% endtrans %} {% elif contest.time_before_end %} {% trans countdown=contest.end_time|as_countdown %}Ends in {{countdown}}{% endtrans %} {% endif %} {{ time_left(contest) }} {% endif %}
{{ _('Format') }}
{{ contest.format.name }}
{{ _('Users') }}
{{ user_count(contest, request.user) }}
{{ contest_join(contest, request) }}
{% endwith %} {% endfor %}

{% endif %}

{{ _('Ongoing Contests') }}

{% if current_contests %}
{% for contest in current_contests %}
{{ _('Contests') }}
{{ contest_head(contest) }}
{{ _('Time') }}
{% if contest.start_time %} {% if contest.time_before_end %} {% trans countdown=contest.end_time|as_countdown %}Ends in {{countdown}}{% endtrans %} {% endif %} {{ time_left(contest) }} {% endif %}
{{ _('Format') }}
{{ contest.format.name }}
{{ _('Users') }}
{{ user_count(contest, request.user) }}
{{ contest_join(contest, request) }}
{% endfor %}
{% else %}
{{ _('There is no ongoing contest at this time.') }}
{% endif %}

{{ _('Upcoming Contests') }}

{% if future_contests %}
{% for contest in future_contests %}
{{ _('Contests') }}
{{ contest_head(contest) }}
{{ _('Time') }}
{% if contest.start_time %} {% if contest.time_before_start %} {{ _('Starting in %(countdown)s.', countdown=contest.start_time|as_countdown) }} {% endif %} {{ time_left(contest) }} {% endif %}
{{ _('Format') }}
{{ contest.format.name }}
{% endfor %}
{% else %}
{{ _('There is no scheduled contest at this time.') }}
{% endif %}

{{ _('Past Contests') }}

{% if past_contests %} {% if page_obj and page_obj.num_pages > 1 %}
{% include "list-pages.html" %}
{% endif %} {% for contest in past_contests %}
{{ _('Contests') }}
{{ contest_head(contest) }}
{{ _('Time') }}
{{ time_left(contest, false) }}
{{ _('Format') }}
{{ contest.format.name }}
{{ _('Users') }}
{{ user_count(contest, request.user) }}
{% if not request.in_contest %}
{% csrf_token %}
{% endif %}
{% endfor %} {% if page_obj and page_obj.num_pages > 1 %}
{% include "list-pages.html" %}
{% endif %} {% else %}
{{ _('There is no past contest.') }}
{% endif %}
{% endblock %}