plateforme-tfjm2/apps/participation/templates/participation/pool_detail.html

90 lines
4.1 KiB
HTML
Raw Normal View History

2021-01-13 16:00:50 +00:00
{% extends "base.html" %}
2021-01-14 13:44:12 +00:00
{% load i18n %}
{% block content %}
<div class="card bg-light shadow">
<div class="card-header text-center">
<h4>{{ pool }}</h4>
</div>
<div class="card-body">
<dl class="row">
2021-01-14 14:59:11 +00:00
<dt class="col-sm-3">{% trans "Tournament:" %}</dt>
<dd class="col-sm-9">{{ pool.tournament }}</dd>
2021-01-14 13:44:12 +00:00
2021-01-14 14:59:11 +00:00
<dt class="col-sm-3">{% trans "Round:" %}</dt>
<dd class="col-sm-9">{{ pool.get_round_display }}</dd>
2021-01-14 13:44:12 +00:00
2021-01-14 14:59:11 +00:00
<dt class="col-sm-3">{% trans "Teams:" %}</dt>
<dd class="col-sm-9">
2021-01-14 13:44:12 +00:00
{% for participation in pool.participations.all %}
<a href="{{ participation.get_absolute_url }}" data-turbolinks="false">{{ participation.team }}{% if not forloop.last %}, {% endif %}</a>
{% endfor %}
</dd>
2021-01-14 14:59:11 +00:00
<dt class="col-sm-3">{% trans "Juries:" %}</dt>
<dd class="col-sm-9">{{ pool.juries.all|join:", " }}</dd>
<dt class="col-sm-3">{% trans "Passages:" %}</dt>
<dd class="col-sm-9">
{% for passage in pool.passages.all %}
<a href="{{ passage.get_absolute_url }}" data-turbolinks="false">{{ passage }}{% if not forloop.last %}, {% endif %}</a>
{% endfor %}
</dd>
<dt class="col-sm-3">{% trans "Defended solutions:" %}</dt>
<dd class="col-sm-9">
{% for passage in pool.passages.all %}
<a href="{{ passage.defended_solution.get_absolute_url }}" data-turbolinks="false">{{ passage.defended_solution }}{% if not forloop.last %}, {% endif %}</a>
{% endfor %}
</dd>
2021-01-14 13:44:12 +00:00
</dl>
</div>
{% if user.registration.is_admin %}
<div class="card-footer text-center">
2021-01-14 14:59:11 +00:00
<button class="btn btn-success" data-toggle="modal" data-target="#addPassageModal">{% trans "Add passage" %}</button>
2021-01-14 13:44:12 +00:00
<button class="btn btn-primary" data-toggle="modal" data-target="#updatePoolModal">{% trans "Update" %}</button>
<button class="btn btn-primary" data-toggle="modal" data-target="#updateTeamsModal">{% trans "Update teams" %}</button>
</div>
{% endif %}
</div>
2021-01-14 14:59:11 +00:00
{% trans "Add passage" as modal_title %}
{% trans "Add" as modal_button %}
{% url "participation:passage_create" pk=pool.pk as modal_action %}
{% include "base_modal.html" with modal_id="addPassage" modal_button_type="success" %}
2021-01-14 13:44:12 +00:00
{% trans "Update pool" as modal_title %}
{% trans "Update" as modal_button %}
{% url "participation:pool_update" pk=pool.pk as modal_action %}
{% include "base_modal.html" with modal_id="updatePool" %}
{% trans "Update teams" as modal_title %}
{% trans "Update" as modal_button %}
{% url "participation:pool_update_teams" pk=pool.pk as modal_action %}
{% include "base_modal.html" with modal_id="updateTeams" %}
{% endblock %}
{% block extrajavascript %}
<script>
$(document).ready(function () {
$('button[data-target="#updatePoolModal"]').click(function() {
let modalBody = $("#updatePoolModal div.modal-body");
if (!modalBody.html().trim())
modalBody.load("{% url "participation:pool_update" pk=pool.pk %} #form-content")
});
$('button[data-target="#updateTeamsModal"]').click(function() {
let modalBody = $("#updateTeamsModal div.modal-body");
if (!modalBody.html().trim())
modalBody.load("{% url "participation:pool_update_teams" pk=pool.pk %} #form-content")
});
2021-01-14 14:59:11 +00:00
$('button[data-target="#addPassageModal"]').click(function() {
let modalBody = $("#addPassageModal div.modal-body");
if (!modalBody.html().trim())
modalBody.load("{% url "participation:passage_create" pk=pool.pk %} #form-content")
});
2021-01-14 13:44:12 +00:00
});
</script>
{% endblock %}