1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-21 07:18:25 +02:00

Teams must send their motivation letter

This commit is contained in:
Yohann D'ANELLO
2021-01-22 09:40:28 +01:00
parent 628f69e772
commit ce206998f0
12 changed files with 402 additions and 224 deletions

View File

@ -85,6 +85,18 @@
{% endif %}
{% endfor %}
</dd>
<dt class="col-sm-6 text-right">{% trans "Motivation letter:" %}</dt>
<dd class="col-sm-6">
{% if team.motivation_letter %}
<a href="{{ team.motivation_letter.url }}" data-turbolinks="false">{% trans "Download" %}</a>
{% else %}
<em>{% trans "Not uploaded yet" %}</em>
{% endif %}
{% if user.registration.team == team and not user.registration.team.participation.valid or user.registration.is_admin %}
<button class="btn btn-primary" data-toggle="modal" data-target="#uploadMotivationLetterModal">{% trans "Replace" %}</button>
{% endif %}
</dd>
</dl>
</div>
<div class="card-footer text-center">
@ -146,6 +158,11 @@
{% endif %}
{% endif %}
{% trans "Upload motivation letter" as modal_title %}
{% trans "Upload" as modal_button %}
{% url "participation:upload_team_motivation_letter" pk=team.pk as modal_action %}
{% include "base_modal.html" with modal_id="uploadMotivationLetter" modal_enctype="multipart/form-data" %}
{% trans "Update team" as modal_title %}
{% trans "Update" as modal_button %}
{% url "participation:update_team" pk=team.pk as modal_action %}
@ -160,6 +177,11 @@
{% block extrajavascript %}
<script>
$(document).ready(function() {
$('button[data-target="#uploadMotivationLetterModal"]').click(function() {
let modalBody = $("#uploadMotivationLetterModal div.modal-body");
if (!modalBody.html().trim())
modalBody.load("{% url "participation:upload_team_motivation_letter" pk=team.pk %} #form-content");
});
$('button[data-target="#updateTeamModal"]').click(function() {
let modalBody = $("#updateTeamModal div.modal-body");
if (!modalBody.html().trim())

View File

@ -0,0 +1,15 @@
{% extends "base.html" %}
{% load i18n static crispy_forms_filters %}
{% block content %}
<a class="btn btn-info" href="{% url "participation:team_detail" pk=object.pk %}"><i class="fas fa-arrow-left"></i> {% trans "Back to the team detail" %}</a>
<hr>
<form method="post" enctype="multipart/form-data">
<div id="form-content">
{% csrf_token %}
{{ form|crispy }}
</div>
<button class="btn btn-success" type="submit">{% trans "Upload" %}</button>
</form>
{% endblock %}