tabbycat/tournaments/templates/set_current_round.html
{% extends "base.html" %}
{% load debate_tags %}
{% load add_field_css i18n %}
{% block page-subnav-sections %}
{% if current_round %}
<a class="btn btn-primary "
href="{% tournamenturl 'options-tournament-index' %}">
<i data-feather="chevron-left"></i> {% trans "Back to Configuration" %}
</a>
{% endif %}
{% endblock %}
{% block body-class %}{% if current_round is None %}override-sidebar-offset{% endif %}{% endblock %}
{% block sidebar %}
{# Don't show the sidebar if there's no current round, because it'll crash. #}
{% if current_round %}
{{ block.super }}
{% endif %}
{% endblock %}
{% block content %}
{% if next %}
<div class="alert alert-warning">
<i data-feather="alert-circle"></i>
{% blocktrans trimmed with tournament=tournament.name %}
No round is currently set. In order for Tabbycat to work, please set the
<strong>current round</strong> of the tournament
<strong>{{ tournament }}</strong>.
{% endblocktrans %}
</div>
{% else %}
<div class="alert alert-info">
<i data-feather="alert-circle"></i>
{% blocktrans trimmed with tournament=tournament.name %}
On this page, you can set the <strong>current round</strong> of the tournament
<strong>{{ tournament }}</strong>.
{% endblocktrans %}
</div>
{% endif %}
{% if not tournament.round_set.exists %}
<div class="alert alert-danger">
<i data-feather="alert-circle"></i>
{% url 'admin:tournaments_round_changelist' as round_changelist_url %}
{% blocktrans trimmed with tournament=tournament.name %}
The tournament <strong>{{ tournament }}</strong> has no rounds.
You'll need to <a href="{{ round_changelist_url }}">add rounds and
associate them with this tournament</a> before you can set the current
round.
{% endblocktrans %}
</div>
{% endif %}
<form action="." method="POST">
<div class="card">
{% csrf_token %}
{% include 'components/form-main.html' %}
{% trans "Set Current Rounds" context "button" as title %}
{% include "components/form-submit.html" %}
</div>
</form>
{% endblock %}
{% block js %}
{{ block.super }}
<script>
$('#id_prelim').change(function () {
if ($('#id_prelim').val() == 'all-completed') {
$('select[id^=id_elim_]').prop('disabled', false);
$('select[id^=id_elim_] option:nth-child(2)').prop('selected', true);
} else {
$('select[id^=id_elim_]').prop('disabled', true);
$('select[id^=id_elim_] option:nth-child(1)').prop('selected', true);
}
});
// disable elimination round fields if preliminary rounds are complete
$(document).ready(function () {
$('select[id^=id_elim_]').prop('disabled', $('#id_prelim').val() != 'all-completed');
});
</script>
{% endblock %}