1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2024-12-25 05:02:23 +00:00

Drop turbolinks support, too useless

This commit is contained in:
Emmy D'Anello 2023-02-20 13:42:36 +01:00
parent 731dfc049f
commit 5abca36498
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
11 changed files with 26 additions and 68 deletions

View File

@ -26,7 +26,7 @@
<dd class="col-sm-10"> <dd class="col-sm-10">
<ul> <ul>
{% for solution in participation.solutions.all %} {% for solution in participation.solutions.all %}
<li><a href="{{ solution.file.url }}" data-turbolinks="false">{{ solution }}</a></li> <li><a href="{{ solution.file.url }}">{{ solution }}</a></li>
{% empty %} {% empty %}
<li>{% trans "No solution was uploaded yet." %}</li> <li>{% trans "No solution was uploaded yet." %}</li>
{% endfor %} {% endfor %}
@ -38,7 +38,7 @@
<dd class="col-sm-10"> <dd class="col-sm-10">
<ul> <ul>
{% for pool in participation.pools.all %} {% for pool in participation.pools.all %}
<li><a href="{{ pool.get_absolute_url }}" data-turbolinks="false">{{ pool }}{% if not forloop.last %}, {% endif %}</a></li> <li><a href="{{ pool.get_absolute_url }}">{{ pool }}{% if not forloop.last %}, {% endif %}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
</dd> </dd>

View File

@ -23,7 +23,7 @@
<dd class="col-sm-9"><a href="{{ passage.reporter.get_absolute_url }}">{{ passage.reporter.team }}</a></dd> <dd class="col-sm-9"><a href="{{ passage.reporter.get_absolute_url }}">{{ passage.reporter.team }}</a></dd>
<dt class="col-sm-3">{% trans "Defended solution:" %}</dt> <dt class="col-sm-3">{% trans "Defended solution:" %}</dt>
<dd class="col-sm-9"><a href="{{ passage.defended_solution.file.url }}" data-turbolinks="false">{{ passage.defended_solution }}</a></dd> <dd class="col-sm-9"><a href="{{ passage.defended_solution.file.url }}">{{ passage.defended_solution }}</a></dd>
<dt class="col-sm-3">{% trans "Defender penalties count:" %}</dt> <dt class="col-sm-3">{% trans "Defender penalties count:" %}</dt>
<dd class="col-sm-9">{{ passage.defender_penalties }}</dd> <dd class="col-sm-9">{{ passage.defender_penalties }}</dd>
@ -31,7 +31,7 @@
<dt class="col-sm-3">{% trans "Syntheses:" %}</dt> <dt class="col-sm-3">{% trans "Syntheses:" %}</dt>
<dd class="col-sm-9"> <dd class="col-sm-9">
{% for synthesis in passage.syntheses.all %} {% for synthesis in passage.syntheses.all %}
<a href="{{ synthesis.file.url }}" data-turbolinks="false">{{ synthesis }}{% if not forloop.last %}, {% endif %}</a> <a href="{{ synthesis.file.url }}">{{ synthesis }}{% if not forloop.last %}, {% endif %}</a>
{% empty %} {% empty %}
{% trans "No synthesis was uploaded yet." %} {% trans "No synthesis was uploaded yet." %}
{% endfor %} {% endfor %}

View File

@ -18,7 +18,7 @@
<dt class="col-sm-3">{% trans "Teams:" %}</dt> <dt class="col-sm-3">{% trans "Teams:" %}</dt>
<dd class="col-sm-9"> <dd class="col-sm-9">
{% for participation in pool.participations.all %} {% for participation in pool.participations.all %}
<a href="{{ participation.get_absolute_url }}" data-turbolinks="false">{{ participation.team }}{% if not forloop.last %}, {% endif %}</a> <a href="{{ participation.get_absolute_url }}">{{ participation.team }}{% if not forloop.last %}, {% endif %}</a>
{% endfor %} {% endfor %}
</dd> </dd>
@ -28,7 +28,7 @@
<dt class="col-sm-3">{% trans "Defended solutions:" %}</dt> <dt class="col-sm-3">{% trans "Defended solutions:" %}</dt>
<dd class="col-sm-9"> <dd class="col-sm-9">
{% for passage in pool.passages.all %} {% for passage in pool.passages.all %}
<a href="{{ passage.defended_solution.file.url }}" data-turbolinks="false">{{ passage.defended_solution }}{% if not forloop.last %}, {% endif %}</a> <a href="{{ passage.defended_solution.file.url }}">{{ passage.defended_solution }}{% if not forloop.last %}, {% endif %}</a>
{% endfor %} {% endfor %}
</dd> </dd>

View File

@ -53,7 +53,7 @@
<dd class="col-sm-6"> <dd class="col-sm-6">
{% for participant in team.participants.all %} {% for participant in team.participants.all %}
{% if participant.photo_authorization %} {% if participant.photo_authorization %}
<a href="{{ participant.photo_authorization.url }}" data-turbolinks="false">{{ participant }}</a>{% if not forloop.last %},{% endif %} <a href="{{ participant.photo_authorization.url }}">{{ participant }}</a>{% if not forloop.last %},{% endif %}
{% else %} {% else %}
{{ participant }} ({% trans "Not uploaded yet" %}){% if not forloop.last %},{% endif %} {{ participant }} ({% trans "Not uploaded yet" %}){% if not forloop.last %},{% endif %}
{% endif %} {% endif %}
@ -66,7 +66,7 @@
{% for student in team.students.all %} {% for student in team.students.all %}
{% if student.under_18 %} {% if student.under_18 %}
{% if student.health_sheet %} {% if student.health_sheet %}
<a href="{{ student.health_sheet.url }}" data-turbolinks="false">{{ student }}</a>{% if not forloop.last %},{% endif %} <a href="{{ student.health_sheet.url }}">{{ student }}</a>{% if not forloop.last %},{% endif %}
{% else %} {% else %}
{{ student }} ({% trans "Not uploaded yet" %}){% if not forloop.last %},{% endif %} {{ student }} ({% trans "Not uploaded yet" %}){% if not forloop.last %},{% endif %}
{% endif %} {% endif %}
@ -79,7 +79,7 @@
{% for student in team.students.all %} {% for student in team.students.all %}
{% if student.under_18 %} {% if student.under_18 %}
{% if student.vaccine_sheet %} {% if student.vaccine_sheet %}
<a href="{{ student.vaccine_sheet.url }}" data-turbolinks="false">{{ student }}</a>{% if not forloop.last %},{% endif %} <a href="{{ student.vaccine_sheet.url }}">{{ student }}</a>{% if not forloop.last %},{% endif %}
{% else %} {% else %}
{{ student }} ({% trans "Not uploaded yet" %}){% if not forloop.last %},{% endif %} {{ student }} ({% trans "Not uploaded yet" %}){% if not forloop.last %},{% endif %}
{% endif %} {% endif %}
@ -92,7 +92,7 @@
{% for student in team.students.all %} {% for student in team.students.all %}
{% if student.under_18 %} {% if student.under_18 %}
{% if student.parental_authorization %} {% if student.parental_authorization %}
<a href="{{ student.parental_authorization.url }}" data-turbolinks="false">{{ student }}</a>{% if not forloop.last %},{% endif %} <a href="{{ student.parental_authorization.url }}">{{ student }}</a>{% if not forloop.last %},{% endif %}
{% else %} {% else %}
{{ student }} ({% trans "Not uploaded yet" %}){% if not forloop.last %},{% endif %} {{ student }} ({% trans "Not uploaded yet" %}){% if not forloop.last %},{% endif %}
{% endif %} {% endif %}
@ -104,7 +104,7 @@
<dt class="col-sm-6 text-right">{% trans "Motivation letter:" %}</dt> <dt class="col-sm-6 text-right">{% trans "Motivation letter:" %}</dt>
<dd class="col-sm-6"> <dd class="col-sm-6">
{% if team.motivation_letter %} {% if team.motivation_letter %}
<a href="{{ team.motivation_letter.url }}" data-turbolinks="false">{% trans "Download" %}</a> <a href="{{ team.motivation_letter.url }}">{% trans "Download" %}</a>
{% else %} {% else %}
<em>{% trans "Not uploaded yet" %}</em> <em>{% trans "Not uploaded yet" %}</em>
{% endif %} {% endif %}
@ -116,7 +116,7 @@
{% if user.registration.is_volunteer %} {% if user.registration.is_volunteer %}
<div class="text-center"> <div class="text-center">
<a class="btn btn-info" href="{% url "participation:team_authorizations" pk=team.pk %}" data-turbolinks="false"> <a class="btn btn-info" href="{% url "participation:team_authorizations" pk=team.pk %}">
<i class="fas fa-file-archive"></i> {% trans "Download all submitted authorizations" %} <i class="fas fa-file-archive"></i> {% trans "Download all submitted authorizations" %}
</a> </a>
</div> </div>

View File

@ -9,7 +9,7 @@
<div id="form-content"> <div id="form-content">
<div class="alert alert-info"> <div class="alert alert-info">
{% trans "Authorization template:" %} {% trans "Authorization template:" %}
<a class="alert-link" href="{% url "registration:parental_authorization_template" %}?registration_id={{ object.pk }}&tournament_id={{ object.team.participation.tournament.pk }}" data-turbolinks="false">{% trans "Download" %}</a> <a class="alert-link" href="{% url "registration:parental_authorization_template" %}?registration_id={{ object.pk }}&tournament_id={{ object.team.participation.tournament.pk }}">{% trans "Download" %}</a>
</div> </div>
{% csrf_token %} {% csrf_token %}
{{ form|crispy }} {{ form|crispy }}

View File

@ -9,8 +9,8 @@
<div id="form-content"> <div id="form-content">
<div class="alert alert-info"> <div class="alert alert-info">
{% trans "Authorization templates:" %} {% trans "Authorization templates:" %}
<a class="alert-link" href="{% url "registration:photo_authorization_adult_template" %}?registration_id={{ object.pk }}&tournament_id={{ object.team.participation.tournament.pk }}" data-turbolinks="false">{% trans "Adult" %}</a> <a class="alert-link" href="{% url "registration:photo_authorization_adult_template" %}?registration_id={{ object.pk }}&tournament_id={{ object.team.participation.tournament.pk }}">{% trans "Adult" %}</a>
<a class="alert-link" href="{% url "registration:photo_authorization_child_template" %}?registration_id={{ object.pk }}&tournament_id={{ object.team.participation.tournament.pk }}" data-turbolinks="false">{% trans "Child" %}</a> <a class="alert-link" href="{% url "registration:photo_authorization_child_template" %}?registration_id={{ object.pk }}&tournament_id={{ object.team.participation.tournament.pk }}">{% trans "Child" %}</a>
</div> </div>
{% csrf_token %} {% csrf_token %}
{{ form|crispy }} {{ form|crispy }}

View File

@ -24,7 +24,7 @@
{% if user_object == user %} {% if user_object == user %}
<dt class="col-sm-6 text-right">{% trans "Password:" %}</dt> <dt class="col-sm-6 text-right">{% trans "Password:" %}</dt>
<dd class="col-sm-6"> <dd class="col-sm-6">
<a href="{% url 'password_change' %}" class="btn-sm btn-secondary" data-turbolinks="false"> <a href="{% url 'password_change' %}" class="btn-sm btn-secondary">
<i class="fas fa-edit"></i> {% trans "Change password" %} <i class="fas fa-edit"></i> {% trans "Change password" %}
</a> </a>
</dd> </dd>
@ -59,7 +59,7 @@
<dt class="col-sm-6 text-right">{% trans "Photo authorization:" %}</dt> <dt class="col-sm-6 text-right">{% trans "Photo authorization:" %}</dt>
<dd class="col-sm-6"> <dd class="col-sm-6">
{% if user_object.registration.photo_authorization %} {% if user_object.registration.photo_authorization %}
<a href="{{ user_object.registration.photo_authorization.url }}" data-turbolinks="false">{% trans "Download" %}</a> <a href="{{ user_object.registration.photo_authorization.url }}">{% trans "Download" %}</a>
{% endif %} {% endif %}
{% if user_object.registration.team and not user_object.registration.team.participation.valid %} {% if user_object.registration.team and not user_object.registration.team.participation.valid %}
<button class="btn btn-primary" data-toggle="modal" data-target="#uploadPhotoAuthorizationModal">{% trans "Replace" %}</button> <button class="btn btn-primary" data-toggle="modal" data-target="#uploadPhotoAuthorizationModal">{% trans "Replace" %}</button>
@ -72,7 +72,7 @@
<dt class="col-sm-6 text-right">{% trans "Health sheet:" %}</dt> <dt class="col-sm-6 text-right">{% trans "Health sheet:" %}</dt>
<dd class="col-sm-6"> <dd class="col-sm-6">
{% if user_object.registration.health_sheet %} {% if user_object.registration.health_sheet %}
<a href="{{ user_object.registration.health_sheet.url }}" data-turbolinks="false">{% trans "Download" %}</a> <a href="{{ user_object.registration.health_sheet.url }}">{% trans "Download" %}</a>
{% endif %} {% endif %}
{% if user_object.registration.team and not user_object.registration.team.participation.valid %} {% if user_object.registration.team and not user_object.registration.team.participation.valid %}
<button class="btn btn-primary" data-toggle="modal" data-target="#uploadHealthSheetModal">{% trans "Replace" %}</button> <button class="btn btn-primary" data-toggle="modal" data-target="#uploadHealthSheetModal">{% trans "Replace" %}</button>
@ -82,7 +82,7 @@
<dt class="col-sm-6 text-right">{% trans "Vaccine sheet:" %}</dt> <dt class="col-sm-6 text-right">{% trans "Vaccine sheet:" %}</dt>
<dd class="col-sm-6"> <dd class="col-sm-6">
{% if user_object.registration.vaccine_sheet %} {% if user_object.registration.vaccine_sheet %}
<a href="{{ user_object.registration.vaccine_sheet.url }}" data-turbolinks="false">{% trans "Download" %}</a> <a href="{{ user_object.registration.vaccine_sheet.url }}">{% trans "Download" %}</a>
{% endif %} {% endif %}
{% if user_object.registration.team and not user_object.registration.team.participation.valid %} {% if user_object.registration.team and not user_object.registration.team.participation.valid %}
<button class="btn btn-primary" data-toggle="modal" data-target="#uploadVaccineSheetModal">{% trans "Replace" %}</button> <button class="btn btn-primary" data-toggle="modal" data-target="#uploadVaccineSheetModal">{% trans "Replace" %}</button>
@ -92,7 +92,7 @@
<dt class="col-sm-6 text-right">{% trans "Parental authorization:" %}</dt> <dt class="col-sm-6 text-right">{% trans "Parental authorization:" %}</dt>
<dd class="col-sm-6"> <dd class="col-sm-6">
{% if user_object.registration.parental_authorization %} {% if user_object.registration.parental_authorization %}
<a href="{{ user_object.registration.parental_authorization.url }}" data-turbolinks="false">{% trans "Download" %}</a> <a href="{{ user_object.registration.parental_authorization.url }}">{% trans "Download" %}</a>
{% endif %} {% endif %}
{% if user_object.registration.team and not user_object.registration.team.participation.valid %} {% if user_object.registration.team and not user_object.registration.team.participation.valid %}
<button class="btn btn-primary" data-toggle="modal" data-target="#uploadParentalAuthorizationModal">{% trans "Replace" %}</button> <button class="btn btn-primary" data-toggle="modal" data-target="#uploadParentalAuthorizationModal">{% trans "Replace" %}</button>
@ -152,7 +152,7 @@
{% endif %} {% endif %}
{% if user_object.registration.payment.type == "scholarship" %} {% if user_object.registration.payment.type == "scholarship" %}
{% if user.registration.is_admin or user == user_object %} {% if user.registration.is_admin or user == user_object %}
<a href="{{ user_object.registration.payment.scholarship_file.url }}" class="btn btn-info" data-turbolinks="false"> <a href="{{ user_object.registration.payment.scholarship_file.url }}" class="btn btn-info">
<i class="fas fa-file-pdf"></i> {% trans "Download scholarship attestation" %} <i class="fas fa-file-pdf"></i> {% trans "Download scholarship attestation" %}
</a> </a>
{% endif %} {% endif %}

View File

@ -52,34 +52,3 @@ class SessionMiddleware(object):
_set_current_user_and_ip(None, None, None) _set_current_user_and_ip(None, None, None)
return response return response
class TurbolinksMiddleware(object): # pragma: no cover
"""
Send the `Turbolinks-Location` header in response to a visit that was redirected,
and Turbolinks will replace the browser's topmost history entry.
"""
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
response = self.get_response(request)
is_turbolinks = request.META.get('HTTP_TURBOLINKS_REFERRER')
is_response_redirect = response.has_header('Location')
if is_turbolinks:
if is_response_redirect:
location = response['Location']
prev_location = request.session.pop('_turbolinks_redirect_to', None)
if prev_location is not None:
# relative subsequent redirect
if location.startswith('.'):
location = prev_location.split('?')[0] + location
request.session['_turbolinks_redirect_to'] = location
else:
if request.session.get('_turbolinks_redirect_to'):
location = request.session.pop('_turbolinks_redirect_to')
response['Turbolinks-Location'] = location
return response

View File

@ -87,7 +87,6 @@ MIDDLEWARE = [
'django.middleware.locale.LocaleMiddleware', 'django.middleware.locale.LocaleMiddleware',
'django.contrib.sites.middleware.CurrentSiteMiddleware', 'django.contrib.sites.middleware.CurrentSiteMiddleware',
'tfjm.middlewares.SessionMiddleware', 'tfjm.middlewares.SessionMiddleware',
'tfjm.middlewares.TurbolinksMiddleware',
] ]
ROOT_URLCONF = 'tfjm.urls' ROOT_URLCONF = 'tfjm.urls'

File diff suppressed because one or more lines are too long

View File

@ -14,24 +14,20 @@
{# Favicon #} {# Favicon #}
<link rel="shortcut icon" href="{% static "favicon.ico" %}"> <link rel="shortcut icon" href="{% static "favicon.ico" %}">
<meta name="theme-color" content="#ffffff"> <meta name="theme-color" content="#ffffff">
{% if no_cache %}
<meta name="turbolinks-cache-control" content="no-cache">
{% endif %}
{# Bootstrap CSS #} {# Bootstrap CSS #}
<link rel="stylesheet" href="{% static 'bootstrap/css/bootstrap.min.css' %}"> <link rel="stylesheet" href="{% static 'bootstrap/css/bootstrap.min.css' %}">
<link rel="stylesheet" href="{% static 'fontawasome/css/all.css' %}"> <link rel="stylesheet" href="{% static 'fontawasome/css/all.css' %}">
<link rel="stylesheet" href="{% static 'fontawasome/css/v4-shims.css' %}"> <link rel="stylesheet" href="{% static 'fontawasome/css/v4-shims.css' %}">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.18/css/bootstrap-select.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.14.0-beta3/css/bootstrap-select.min.css">
{# JQuery, Bootstrap and Turbolinks JavaScript #} {# JQuery and Bootstrap JavaScript #}
<script src="{% static 'jquery/jquery-3.6.0.min.js' %}"></script> <script src="{% static 'jquery/jquery-3.6.0.min.js' %}"></script>
<script src="{% static 'bootstrap/js/bootstrap.bundle.min.js' %}"></script> <script src="{% static 'bootstrap/js/bootstrap.bundle.min.js' %}"></script>
<script src="{% static 'turbolinks/turbolinks.js' %}"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.14.0-beta3/js/bootstrap-select.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.14.0-beta3/js/bootstrap-select.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.18/js/i18n/defaults-fr_FR.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.14.0-beta3/js/i18n/defaults-fr_FR.min.js"></script>
{# Si un formulaire requiert des données supplémentaires (notamment JS), les données sont chargées #} {# Si un formulaire requiert des données supplémentaires (notamment JS), les données sont chargées #}
{% if form.media %} {% if form.media %}
@ -100,7 +96,7 @@
</li> </li>
{% if user.admin %} {% if user.admin %}
<li class="nav-item active"> <li class="nav-item active">
<a data-turbolinks="false" class="nav-link" href="{% url "admin:index" %}"><i class="fas fa-cog"></i> {% trans "Administration" %}</a> <a class="nav-link" href="{% url "admin:index" %}"><i class="fas fa-cog"></i> {% trans "Administration" %}</a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
@ -209,7 +205,7 @@
</form> </form>
</div> </div>
<div class="col text-right"> <div class="col text-right">
<a href="#" data-turbolinks="false" class="text-muted"> <a href="#" class="text-muted">
<i class="fa fa-arrow-up" aria-hidden="true"></i> <i class="fa fa-arrow-up" aria-hidden="true"></i>
</a> </a>
</div> </div>