Add official contest
This commit is contained in:
parent
796a670cd7
commit
10e50795d9
25 changed files with 882 additions and 362 deletions
|
@ -1,7 +1,8 @@
|
|||
<div class="left-sidebar">
|
||||
{{ make_tab_item('list', 'fa fa-list', url('contest_list'), _('List')) }}
|
||||
{{ make_tab_item('list', 'fa fa-list', url('contest_list'), _('All')) }}
|
||||
{{ make_tab_item('official', 'fa fa-check-circle-o', url('official_contest_list'), _('Official')) }}
|
||||
{{ make_tab_item('calendar', 'fa fa-calendar', url('contest_calendar', now.year, now.month), _('Calendar')) }}
|
||||
{% if perms.judge.change_contest %}
|
||||
{{ make_tab_item('admin', 'fa fa-edit', url('admin:judge_contest_changelist'), _('Admin')) }}
|
||||
{{ make_tab_item('admin', 'fa fa-edit', url('admin:judge_contest_changelist'), _('Admin'), force_new_page=True) }}
|
||||
{% endif %}
|
||||
</div>
|
|
@ -24,7 +24,7 @@
|
|||
{% endif %}
|
||||
{% endif %}
|
||||
{% if request.user.is_superuser and contest_has_hidden_subtasks %}
|
||||
{{ make_tab_item('resolver', 'fa fa-check', url('resolver', contest.key), _('Resolver')) }}
|
||||
{{ make_tab_item('resolver', 'fa fa-check', url('resolver', contest.key), _('Resolver'), force_new_page=True) }}
|
||||
{% endif %}
|
||||
{% if show_final_ranking %}
|
||||
{{ make_tab_item('final_ranking', 'fa fa-bar-chart', url('contest_final_ranking', contest.key), _('Final rankings')) }}
|
||||
|
@ -33,6 +33,6 @@
|
|||
{% 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')) }}
|
||||
{{ make_tab_item('edit', 'fa fa-edit', url('admin:judge_contest_change', contest.id), _('Edit'), force_new_page=True) }}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
|
|
@ -21,7 +21,14 @@
|
|||
#search-org {
|
||||
width: 100%;
|
||||
}
|
||||
.contest-format-user {
|
||||
flex: 0.5 !important;
|
||||
}
|
||||
.participate-button {
|
||||
float: right;
|
||||
}
|
||||
</style>
|
||||
{% block contest_list_media %}{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
{% block three_col_js %}
|
||||
|
@ -75,7 +82,7 @@
|
|||
|
||||
var $form = $('form#filter-form');
|
||||
|
||||
$('#show_orgs').click(function () {
|
||||
$('#hide_organization_contests').click(function () {
|
||||
submitFormWithParams($form, "POST");
|
||||
});
|
||||
$('#go').click(function() {
|
||||
|
@ -110,6 +117,8 @@
|
|||
|
||||
$('#search-org').select2({multiple: 1, placeholder: '{{ _('Groups') }}...'});
|
||||
|
||||
$('#order').select2();
|
||||
|
||||
// var tooltip_classes = 'tooltipped tooltipped-e';
|
||||
//
|
||||
// $('.contest-tag').each(function () {
|
||||
|
@ -122,6 +131,7 @@
|
|||
// });
|
||||
});
|
||||
</script>
|
||||
{% block contest_list_js %}{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
{% block left_sidebar %}
|
||||
|
@ -134,7 +144,31 @@
|
|||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% from "contest/macros.html" import contest_head, time_left, user_count, contest_join, contest_format_user %}
|
||||
{% from "contest/macros.html" import contest_head, time_left, user_count, contest_format_user %}
|
||||
|
||||
{% macro contest_join(contest, request, is_past=False) %}
|
||||
{% if request.in_contest and request.participation.contest == contest %}
|
||||
<button class="small" disabled>{{ _('In contest') }}</button>
|
||||
{% elif is_past %}
|
||||
<form action="{{ url('contest_join', contest.key) }}" method="post">
|
||||
{% csrf_token %}
|
||||
<input type="submit" class="unselectable button full small"
|
||||
value="{{ _('Virtual join') }}">
|
||||
</form>
|
||||
{% elif request.profile.id in contest.editor_ids or request.profile.id in contest.tester_ids %}
|
||||
<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 %}
|
||||
{% endmacro %}
|
||||
|
||||
{% block middle_content %}
|
||||
<div class="tabs tabs-no-flex" style="width: 100%;margin-left: auto;margin-right: auto;">
|
||||
|
@ -192,11 +226,11 @@
|
|||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-contest" style="flex: 0.5;">
|
||||
{{ contest_format_user(contest, request) }}
|
||||
</div>
|
||||
<div class="participate-button">
|
||||
{{ contest_join(contest, request) }}
|
||||
<div class="info-contest contest-format-user">
|
||||
{{ contest_format_user(contest, request, is_official=is_official) }}
|
||||
<div class="participate-button">
|
||||
{{ contest_join(contest, request) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endwith %}
|
||||
|
@ -230,11 +264,11 @@
|
|||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-contest" style="flex: 0.5;">
|
||||
{{ contest_format_user(contest, request) }}
|
||||
</div>
|
||||
<div class="participate-button">
|
||||
{{ contest_join(contest, request) }}
|
||||
<div class="info-contest contest-format-user">
|
||||
{{ contest_format_user(contest, request, is_official=is_official) }}
|
||||
<div class="participate-button">
|
||||
{{ contest_join(contest, request) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
@ -267,8 +301,8 @@
|
|||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-contest" style="flex: 0.5;">
|
||||
{{ contest_format_user(contest, request, show_user=False) }}
|
||||
<div class="info-contest contest-format-user">
|
||||
{{ contest_format_user(contest, request, show_user=False, is_official=is_official) }}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
@ -296,19 +330,11 @@
|
|||
{{ time_left(contest) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-contest" style="flex: 0.5;">
|
||||
{{ contest_format_user(contest, request) }}
|
||||
</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 %}
|
||||
<div class="info-contest contest-format-user">
|
||||
{{ contest_format_user(contest, request, is_official=is_official) }}
|
||||
<div class="participate-button">
|
||||
{{ contest_join(contest, request, is_past=True) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
|
|
@ -77,30 +77,24 @@
|
|||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro contest_join(contest, request) %}
|
||||
{% if request.in_contest and request.participation.contest == contest %}
|
||||
<button class="small" disabled>{{ _('In contest') }}</button>
|
||||
{% elif request.profile.id in contest.editor_ids or request.profile.id in contest.tester_ids %}
|
||||
<form action="{{ url('contest_join', contest.key) }}" method="post">
|
||||
{% csrf_token %}
|
||||
<input type="submit" class="unselectable button full small"
|
||||
value="{{ _('Spectate') }}">
|
||||
</form>
|
||||
{% macro contest_format_user(contest, request, show_user=True, is_official=False) %}
|
||||
{% if is_official %}
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<div><b>{{ _('Format') }}</b>: {{ contest.format.name }}</div>
|
||||
<div><b>{{ _('Category') }}</b>: {{ contest.official.category.name }}</div>
|
||||
<div><b>{{ _('Location') }}</b>: {{ contest.official.location.name }}</div>
|
||||
<div><b>{{ _('Year') }}</b>: {{ contest.official.year }}</div>
|
||||
{% if show_user %}
|
||||
<div class="contest-title" style="margin-top: 0.4em">{{ user_count(contest, request.user) }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% 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>
|
||||
<div style="display: flex; flex-direction: column;">
|
||||
<div class="contest-title"> {{ _('Format') }} </div>
|
||||
<div style="flex-grow: 1">{{ contest.format.name }}</div>
|
||||
{% if show_user %}
|
||||
<div class="contest-title" style="margin-top: 0.4em">{{ user_count(contest, request.user) }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro contest_format_user(contest, request, show_user=True) %}
|
||||
<div style="display: flex; flex-direction: column; height: 100%;">
|
||||
<div class="contest-title"> {{ _('Format') }} </div>
|
||||
<div style="flex-grow: 1">{{ contest.format.name }}</div>
|
||||
{% if show_user %}
|
||||
<div class="contest-title">{{ user_count(contest, request.user) }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endmacro %}
|
57
templates/contest/official-search-form.html
Normal file
57
templates/contest/official-search-form.html
Normal file
|
@ -0,0 +1,57 @@
|
|||
<div class="sidebox">
|
||||
<h3 class="colored-text"><i class="fa fa-search"></i>{{ _('Contest search') }}</h3>
|
||||
<div class="sidebox-content">
|
||||
<form id="filter-form" method="GET">
|
||||
<input id="search-contest" type="text" name="contest" value="{{ contest_query or '' }}"
|
||||
placeholder="{{ _('Search contests...') }}">
|
||||
|
||||
<div class="filter-form-group">
|
||||
<label class="bold-text margin-label" for="year_from"><i class="non-italics">{{ _('Year') }}</i></label>
|
||||
<div class="year-range">
|
||||
<input type="number" name="year_from" id="year_from" value="{{ year_from or '' }}"
|
||||
placeholder="{{ _('From') }}">
|
||||
<input type="number" name="year_to" id="year_to" value="{{ year_to or '' }}"
|
||||
placeholder="{{ _('To') }}" style="float: right">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="filter-form-group">
|
||||
<label class="bold-text margin-label" for="category"><i class="non-italics">{{ _('Category') }}</i></label>
|
||||
<select id="category" name="category" multiple>
|
||||
{% for cat in categories %}
|
||||
<option value="{{ cat.id }}"{% if cat.id in selected_categories %} selected{% endif %}>
|
||||
{{ cat.name }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="filter-form-group">
|
||||
<label class="bold-text margin-label" for="location"><i class="non-italics">{{ _('Location') }}</i></label>
|
||||
<select id="location" name="location" style="width: 100%" multiple>
|
||||
{% for loc in locations %}
|
||||
<option value="{{ loc.id }}"{% if loc.id in selected_locations %} selected{% endif %}>
|
||||
{{ loc.name }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="filter-form-group">
|
||||
<label for="order" class="bold-text margin-label">{{ _('Order by') }}</label>
|
||||
<select id="order" name="order" style="width: 100%">
|
||||
<option value="">---</option>
|
||||
{% for value, name in all_sort_options %}
|
||||
<option value="{{value}}"{% if selected_order == value%} selected{% endif %}>
|
||||
{{ name }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-submit-group">
|
||||
<a id="go" class="button small">{{ _('Go') }}</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
42
templates/contest/official_list.html
Normal file
42
templates/contest/official_list.html
Normal file
|
@ -0,0 +1,42 @@
|
|||
{% extends "contest/list.html" %}
|
||||
|
||||
{% block contest_list_media %}
|
||||
<style type="text/css">
|
||||
.contest-format-user {
|
||||
flex: 1 !important;
|
||||
}
|
||||
|
||||
.year-range {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.year-range input {
|
||||
width: 45%;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block contest_list_js %}
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$("#category").select2();
|
||||
$("#location").select2();
|
||||
$('#year_from').keypress(function (e) {
|
||||
if (e.keyCode === 13) {
|
||||
$('#go').click();
|
||||
}
|
||||
});
|
||||
$('#year_to').keypress(function (e) {
|
||||
if (e.keyCode === 13) {
|
||||
$('#go').click();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block right_sidebar %}
|
||||
<div class="right-sidebar">
|
||||
{% include "contest/official-search-form.html" %}
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -6,8 +6,8 @@
|
|||
placeholder="{{ _('Search contests...') }}">
|
||||
{% if organizations %}
|
||||
<div style="margin-bottom: 1em;">
|
||||
<input id="show_orgs" type="checkbox" name="show_orgs" value="1" {% if show_orgs %}checked{% endif %}>
|
||||
<label for="show_orgs">{{ _('Hide organization contests') }}</label>
|
||||
<input id="hide_organization_contests" type="checkbox" name="hide_organization_contests" value="1" {% if hide_organization_contests %}checked{% endif %}>
|
||||
<label for="hide_organization_contests">{{ _('Hide organization contests') }}</label>
|
||||
</div>
|
||||
<label for="search-org" class="bold-text margin-label">{{ _('Group') }}</label>
|
||||
<select id="search-org" name="orgs" multiple>
|
||||
|
@ -18,6 +18,17 @@
|
|||
{% endfor %}
|
||||
</select>
|
||||
{% endif %}
|
||||
<div class="filter-form-group">
|
||||
<label for="order" class="bold-text margin-label">{{ _('Order by') }}</label>
|
||||
<select id="order" name="order" style="width: 100%">
|
||||
<option value="">---</option>
|
||||
{% for value, name in all_sort_options %}
|
||||
<option value="{{value}}"{% if selected_order == value%} selected{% endif %}>
|
||||
{{ name }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-submit-group">
|
||||
<a id="go" class="button small">{{ _('Go') }}</a>
|
||||
{% if create_url %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue