2024-05-06 03:47:57 +00:00
|
|
|
{% extends "three-column-content.html" %}
|
2020-01-21 06:35:58 +00:00
|
|
|
{% block meta %}
|
2023-01-27 23:11:10 +00:00
|
|
|
<meta name="description" content="The {{ SITE_NAME }}'s contest list - past, present, and future.">
|
2020-01-21 06:35:58 +00:00
|
|
|
{% endblock %}
|
|
|
|
|
2024-05-06 03:47:57 +00:00
|
|
|
{% block three_col_media %}
|
2023-01-27 23:11:10 +00:00
|
|
|
<style>
|
2023-09-08 16:22:57 +00:00
|
|
|
.non-padding-top {
|
|
|
|
padding-top: 0;
|
|
|
|
}
|
|
|
|
|
2023-01-27 23:11:10 +00:00
|
|
|
.btn-contest {
|
|
|
|
display: inline-block;
|
|
|
|
padding: 1px 6px;
|
|
|
|
}
|
2021-02-19 05:32:54 +00:00
|
|
|
|
2024-05-06 03:47:57 +00:00
|
|
|
#search-contest {
|
|
|
|
width: 100%;
|
|
|
|
height: 2.3em;
|
2023-01-27 23:11:10 +00:00
|
|
|
}
|
2024-05-06 03:47:57 +00:00
|
|
|
#search-org {
|
|
|
|
width: 100%;
|
2023-01-27 23:11:10 +00:00
|
|
|
}
|
|
|
|
</style>
|
2020-01-21 06:35:58 +00:00
|
|
|
{% endblock %}
|
|
|
|
|
2024-05-06 03:47:57 +00:00
|
|
|
{% block three_col_js %}
|
2023-01-27 23:11:10 +00:00
|
|
|
<script src="{{ static('libs/featherlight/featherlight.min.js') }}" type="text/javascript"></script>
|
|
|
|
<script type="text/javascript">
|
2024-05-25 18:27:20 +00:00
|
|
|
function changeTabParameter(newTab) {
|
|
|
|
const url = new URL(window.location);
|
|
|
|
const searchParams = new URLSearchParams(url.search);
|
|
|
|
searchParams.set('tab', newTab);
|
|
|
|
url.search = searchParams.toString();
|
|
|
|
return url.href;
|
|
|
|
}
|
|
|
|
|
|
|
|
function submitFormWithParams($form, method) {
|
|
|
|
const currentUrl = new URL(window.location.href);
|
|
|
|
const searchParams = new URLSearchParams(currentUrl.search);
|
|
|
|
const formData = $form.serialize();
|
|
|
|
|
|
|
|
const params = new URLSearchParams(formData);
|
|
|
|
|
|
|
|
if (searchParams.has('tab')) {
|
|
|
|
params.set('tab', searchParams.get('tab'));
|
|
|
|
}
|
|
|
|
|
|
|
|
const fullUrl = currentUrl.pathname + '?' + params.toString();
|
|
|
|
|
|
|
|
if (method === "GET") {
|
|
|
|
window.location.href = fullUrl;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
var $formToSubmit = $('<form>')
|
|
|
|
.attr('action', fullUrl)
|
|
|
|
.attr('method', 'POST')
|
|
|
|
.appendTo('body');
|
|
|
|
|
|
|
|
$formToSubmit.append($('<input>').attr({
|
|
|
|
type: 'hidden',
|
|
|
|
name: 'csrfmiddlewaretoken',
|
|
|
|
value: $.cookie('csrftoken')
|
|
|
|
}));
|
|
|
|
|
|
|
|
$formToSubmit.submit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-27 23:11:10 +00:00
|
|
|
$(document).ready(function () {
|
2024-05-25 18:27:20 +00:00
|
|
|
$('#active-url').attr('href', changeTabParameter('active'));
|
|
|
|
$('#current-url').attr('href', changeTabParameter('current'));
|
|
|
|
$('#future-url').attr('href', changeTabParameter('future'));
|
|
|
|
$('#past-url').attr('href', changeTabParameter('past'));
|
|
|
|
|
2023-02-08 19:12:23 +00:00
|
|
|
var $form = $('form#filter-form');
|
2024-05-25 18:27:20 +00:00
|
|
|
|
2024-05-06 03:47:57 +00:00
|
|
|
$('#show_orgs').click(function () {
|
2024-05-25 18:27:20 +00:00
|
|
|
submitFormWithParams($form, "POST");
|
2024-05-06 03:47:57 +00:00
|
|
|
});
|
|
|
|
$('#go').click(function() {
|
2024-05-25 18:27:20 +00:00
|
|
|
submitFormWithParams($form, "GET");
|
2023-02-08 19:12:23 +00:00
|
|
|
});
|
2023-01-27 23:11:10 +00:00
|
|
|
$('.time-remaining').each(function () {
|
|
|
|
count_down($(this));
|
|
|
|
});
|
2020-01-21 06:35:58 +00:00
|
|
|
|
2023-01-27 23:11:10 +00:00
|
|
|
$('.contest-tag').find('a[data-featherlight]').featherlight();
|
2020-01-21 06:35:58 +00:00
|
|
|
|
2023-01-27 23:11:10 +00:00
|
|
|
$('.join-warning').click(function () {
|
2024-04-25 03:33:57 +00:00
|
|
|
let q = '{{ _('Are you sure you want to join?') }}\n' +
|
|
|
|
'{{ _('Joining a contest for the first time starts your timer, after which it becomes unstoppable.') }}';
|
|
|
|
{% if request.in_contest %}
|
|
|
|
q += " {{ _('By joining in this contest, you will automatically leave contest') }} \"{{ request.participation.contest.name }}\". ";
|
|
|
|
{% endif %}
|
|
|
|
return confirm(q);
|
2023-01-27 23:11:10 +00:00
|
|
|
});
|
2020-01-21 06:35:58 +00:00
|
|
|
|
2024-05-25 18:27:20 +00:00
|
|
|
$form.on('keypress', function(e) {
|
|
|
|
if (e.key === 'Enter') {
|
|
|
|
e.preventDefault();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2024-05-06 03:47:57 +00:00
|
|
|
$('#search-contest').keypress(function (e) {
|
2024-05-25 18:27:20 +00:00
|
|
|
if (e.keyCode === 13) {
|
|
|
|
$('#go').click();
|
|
|
|
}
|
2024-05-06 03:47:57 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
$('#search-org').select2({multiple: 1, placeholder: '{{ _('Groups') }}...'});
|
2021-02-19 08:02:12 +00:00
|
|
|
|
2023-01-27 23:11:10 +00:00
|
|
|
// 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>
|
2020-01-21 06:35:58 +00:00
|
|
|
{% endblock %}
|
|
|
|
|
2022-05-28 04:28:22 +00:00
|
|
|
{% block left_sidebar %}
|
2023-01-27 23:11:10 +00:00
|
|
|
{% include "contest/contest-list-tabs.html" %}
|
2020-01-21 06:35:58 +00:00
|
|
|
{% endblock %}
|
|
|
|
|
2024-05-06 03:47:57 +00:00
|
|
|
{% block right_sidebar %}
|
|
|
|
<div class="right-sidebar">
|
|
|
|
{% include "contest/search-form.html" %}
|
|
|
|
</div>
|
|
|
|
{% endblock %}
|
|
|
|
|
2024-05-29 05:14:42 +00:00
|
|
|
{% from "contest/macros.html" import contest_head, time_left, user_count, contest_join, contest_format_user %}
|
2024-04-23 20:36:51 +00:00
|
|
|
|
2024-05-06 03:47:57 +00:00
|
|
|
{% block middle_content %}
|
2024-05-25 18:27:20 +00:00
|
|
|
<div class="tabs tabs-no-flex" style="width: 100%;margin-left: auto;margin-right: auto;">
|
|
|
|
<ul>
|
|
|
|
{% if request.user.is_authenticated %}
|
|
|
|
<li class="{{'active' if current_tab=='active'}}">
|
|
|
|
<a id='active-url'>{{ _('Active') }}
|
|
|
|
{% if active_count %}
|
|
|
|
({{active_count}})
|
|
|
|
{% endif %}
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
{% endif %}
|
|
|
|
<li class="{{'active' if current_tab=='current'}}">
|
|
|
|
<a id='current-url'>{{ _('Ongoing') }}
|
|
|
|
{% if current_count %}
|
|
|
|
({{current_count}})
|
|
|
|
{% endif %}
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="{{'active' if current_tab=='future'}}">
|
|
|
|
<a id='future-url'>{{ _('Upcoming') }}
|
|
|
|
{% if future_count %}
|
|
|
|
({{future_count}})
|
|
|
|
{% endif %}
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="{{'active' if current_tab=='past'}}">
|
|
|
|
<a id='past-url'>{{ _('Past') }}</a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
2020-01-21 06:35:58 +00:00
|
|
|
|
2024-05-25 18:27:20 +00:00
|
|
|
{% if request.user.is_authenticated and current_tab == 'active' %}
|
|
|
|
{% if contests %}
|
|
|
|
{% for participation in contests %}
|
|
|
|
{% with contest=participation.contest %}
|
2023-09-08 16:22:57 +00:00
|
|
|
<div class="list-contest">
|
2024-04-23 20:36:51 +00:00
|
|
|
<div class="info-contest">
|
2023-09-08 16:22:57 +00:00
|
|
|
<div class="contest-title"> {{ _('Contests') }} </div>
|
2024-05-29 19:22:58 +00:00
|
|
|
{{ contest_head(contest, organization) }}
|
2023-09-08 16:22:57 +00:00
|
|
|
</div>
|
2024-04-23 20:36:51 +00:00
|
|
|
<div class="info-contest">
|
2023-09-08 16:22:57 +00:00
|
|
|
<div class="contest-title"> {{ _('Time') }} </div>
|
|
|
|
<div class="contest-block">
|
|
|
|
{% if contest.start_time %}
|
2024-04-23 20:36:51 +00:00
|
|
|
{{ time_left(contest) }}
|
2024-05-25 18:27:20 +00:00
|
|
|
{% 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 %}
|
2023-09-08 16:22:57 +00:00
|
|
|
<span class="time">{% trans countdown=contest.end_time|as_countdown %}Ends in {{countdown}}{% endtrans %}</span>
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-04-23 20:36:51 +00:00
|
|
|
<div class="info-contest" style="flex: 0.5;">
|
2024-05-29 05:14:42 +00:00
|
|
|
{{ contest_format_user(contest, request) }}
|
2023-09-08 16:22:57 +00:00
|
|
|
</div>
|
|
|
|
<div class="participate-button">
|
|
|
|
{{ contest_join(contest, request) }}
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-05-25 18:27:20 +00:00
|
|
|
{% endwith %}
|
|
|
|
{% endfor %}
|
|
|
|
{% if page_obj and page_obj.num_pages > 1 %}
|
|
|
|
<div style="margin-top: 10px;">
|
|
|
|
{% include "list-pages.html" %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2023-08-30 05:13:34 +00:00
|
|
|
{% else %}
|
2024-05-25 18:27:20 +00:00
|
|
|
<i> {{ _('There is no active contest at this time.') }} </i>
|
2023-01-27 23:11:10 +00:00
|
|
|
{% endif %}
|
2024-05-25 18:27:20 +00:00
|
|
|
{% endif %}
|
2020-01-21 06:35:58 +00:00
|
|
|
|
2024-05-25 18:27:20 +00:00
|
|
|
{% if current_tab == 'current' %}
|
|
|
|
{% if contests %}
|
|
|
|
{% for contest in contests %}
|
|
|
|
<div class="list-contest">
|
|
|
|
<div class="info-contest">
|
|
|
|
<div class="contest-title"> {{ _('Contests') }} </div>
|
2024-05-29 19:22:58 +00:00
|
|
|
{{ contest_head(contest, organization) }}
|
2024-05-25 18:27:20 +00:00
|
|
|
</div>
|
|
|
|
<div class="info-contest">
|
|
|
|
<div class="contest-title"> {{ _('Time') }} </div>
|
|
|
|
<div class="contest-block">
|
|
|
|
{% if contest.start_time %}
|
|
|
|
{{ time_left(contest) }}
|
|
|
|
{% if contest.time_before_end %}
|
|
|
|
<span class="time">{% trans countdown=contest.end_time|as_countdown %}Ends in {{countdown}}{% endtrans %}</span>
|
2023-09-08 16:22:57 +00:00
|
|
|
{% endif %}
|
2024-05-25 18:27:20 +00:00
|
|
|
{% endif %}
|
2023-09-08 16:22:57 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2024-05-25 18:27:20 +00:00
|
|
|
<div class="info-contest" style="flex: 0.5;">
|
2024-05-29 05:14:42 +00:00
|
|
|
{{ contest_format_user(contest, request) }}
|
2024-05-25 18:27:20 +00:00
|
|
|
</div>
|
|
|
|
<div class="participate-button">
|
|
|
|
{{ contest_join(contest, request) }}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
|
|
|
{% if page_obj and page_obj.num_pages > 1 %}
|
|
|
|
<div style="margin-top: 10px;">
|
|
|
|
{% include "list-pages.html" %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2023-01-27 23:11:10 +00:00
|
|
|
{% else %}
|
2024-05-25 18:27:20 +00:00
|
|
|
<i> {{ _('There is no ongoing contest at this time.') }} </i>
|
2023-01-27 23:11:10 +00:00
|
|
|
{% endif %}
|
2024-05-25 18:27:20 +00:00
|
|
|
{% endif %}
|
2023-01-27 23:11:10 +00:00
|
|
|
|
2024-05-25 18:27:20 +00:00
|
|
|
{% if current_tab == 'future' %}
|
|
|
|
{% if contests %}
|
|
|
|
{% for contest in contests %}
|
|
|
|
<div class="list-contest">
|
|
|
|
<div class="info-contest">
|
|
|
|
<div class="contest-title"> {{ _('Contests') }} </div>
|
2024-05-29 19:22:58 +00:00
|
|
|
{{ contest_head(contest, organization) }}
|
2024-05-25 18:27:20 +00:00
|
|
|
</div>
|
|
|
|
<div class="info-contest">
|
|
|
|
<div class="contest-title"> {{ _('Time') }} </div>
|
|
|
|
<div class="contest-block">
|
|
|
|
{% if contest.start_time %}
|
|
|
|
{{ time_left(contest) }}
|
|
|
|
{% if contest.time_before_start %}
|
|
|
|
<span class="time">{{ _('Starting in %(countdown)s.', countdown=contest.start_time|as_countdown) }}</span>
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="info-contest" style="flex: 0.5;">
|
2024-05-29 05:14:42 +00:00
|
|
|
{{ contest_format_user(contest, request, show_user=False) }}
|
2024-05-25 18:27:20 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
|
|
|
{% if page_obj and page_obj.num_pages > 1 %}
|
|
|
|
<div style="margin-top: 10px;">
|
|
|
|
{% include "list-pages.html" %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
{% else %}
|
|
|
|
<i>{{ _('There is no scheduled contest at this time.') }}</i>
|
2024-04-23 20:36:51 +00:00
|
|
|
{% endif %}
|
2024-05-25 18:27:20 +00:00
|
|
|
{% endif %}
|
2023-09-08 16:22:57 +00:00
|
|
|
|
2024-05-25 18:27:20 +00:00
|
|
|
{% if current_tab == 'past' %}
|
|
|
|
{% if contests %}
|
|
|
|
{% for contest in contests %}
|
|
|
|
<div class="list-contest">
|
|
|
|
<div class="info-contest">
|
|
|
|
<div class="contest-title"> {{ _('Contests') }} </div>
|
2024-05-29 19:22:58 +00:00
|
|
|
{{ contest_head(contest, organization) }}
|
2024-05-25 18:27:20 +00:00
|
|
|
</div>
|
|
|
|
<div class="info-contest">
|
|
|
|
<div class="contest-title"> {{ _('Time') }} </div>
|
|
|
|
<div class="contest-block">
|
|
|
|
{{ time_left(contest) }}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="info-contest" style="flex: 0.5;">
|
2024-05-29 05:14:42 +00:00
|
|
|
{{ contest_format_user(contest, request) }}
|
2024-05-25 18:27:20 +00:00
|
|
|
</div>
|
|
|
|
<div class="participate-button">
|
|
|
|
{% if request.in_contest and request.participation.contest == contest %}
|
|
|
|
<button class="small" disabled>{{ _('In contest') }}</button>
|
|
|
|
{% else %}
|
|
|
|
<form action="{{ url('contest_join', contest.key) }}" method="post">
|
|
|
|
{% csrf_token %}
|
|
|
|
<input type="submit" class="unselectable button full small"
|
|
|
|
value="{{ _('Virtual join') }}">
|
|
|
|
</form>
|
|
|
|
{% endif %}
|
2023-09-08 16:22:57 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2024-05-25 18:27:20 +00:00
|
|
|
{% endfor %}
|
|
|
|
{% if page_obj and page_obj.num_pages > 1 %}
|
|
|
|
<div style="margin-top: 10px;">
|
|
|
|
{% include "list-pages.html" %}
|
2024-04-25 03:33:57 +00:00
|
|
|
</div>
|
2024-05-25 18:27:20 +00:00
|
|
|
{% endif %}
|
|
|
|
{% else %}
|
2024-04-23 20:36:51 +00:00
|
|
|
<i> {{ _('There is no past contest.') }} </i>
|
2024-05-25 18:27:20 +00:00
|
|
|
{% endif %}
|
2024-04-23 20:36:51 +00:00
|
|
|
{% endif %}
|
2020-01-21 06:35:58 +00:00
|
|
|
{% endblock %}
|