Projet

Général

Profil

0001-Prevent-double-loading-of-jQuery-25045.patch

Benjamin Dauvergne, 02 août 2018 17:02

Télécharger (2,23 ko)

Voir les différences:

Subject: [PATCH 1/4] Prevent double loading of jQuery (#25045)

Popup dialog were broken by double loading of jQuery by gadjo/root.html
template. We override the gadjo-js block to empty it and we add the
javascript file expected by gadjo in the views default medias.

Rendering of form.media was also removed as MediaMixin already take care
of merging it in the view Media object.
 .../manager/templates/authentic2/manager/base.html          | 1 +
 src/authentic2/manager/views.py                             | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)
src/authentic2/manager/templates/authentic2/manager/base.html
1 1
{% extends "gadjo/base.html" %}
2 2
{% load i18n staticfiles %}
3 3

  
4
{% block gadjo-js %}{% endblock %}
4 5
{% block bodyargs %} class="{% block bodyclasses %}{% endblock %}"{% endblock %}
5 6

  
6 7
{% block page-title %}{% firstof manager_site_title site_title "Authentic2" %}{% endblock %}
src/authentic2/manager/views.py
20 20

  
21 21
from django_select2.views import AutoResponseView
22 22

  
23
from gadjo.templatetags.gadjo import xstatic
24

  
23 25
from django_rbac.utils import get_ou_model
24 26

  
25 27
from authentic2.data_transfer import export_site, import_site, DataImportError, ImportContext
......
50 52
    class Media:
51 53
        js = (
52 54
            reverse_lazy('a2-manager-javascript-catalog'),
53
            'xstatic/jquery.js',
55
            xstatic('jquery.js', 'jquery.min.js'),
56
            xstatic('jquery-ui.js', 'jquery-ui.min.js'),
57
            'js/gadjo.js',
54 58
            'jquery/js/jquery.form.js',
55 59
            'admin/js/urlify.js',
56 60
            'authentic2/js/purl.js',
57
-