From 1cd022546a01f33c293fff2cee8c524ec1a7e756 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Thu, 2 Aug 2018 16:28:48 +0200 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. --- .../manager/templates/authentic2/manager/base.html | 1 + src/authentic2/manager/views.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/authentic2/manager/templates/authentic2/manager/base.html b/src/authentic2/manager/templates/authentic2/manager/base.html index 4ad28f8b..b1f3ed35 100644 --- a/src/authentic2/manager/templates/authentic2/manager/base.html +++ b/src/authentic2/manager/templates/authentic2/manager/base.html @@ -1,6 +1,7 @@ {% extends "gadjo/base.html" %} {% load i18n staticfiles %} +{% block gadjo-js %}{% endblock %} {% block bodyargs %} class="{% block bodyclasses %}{% endblock %}"{% endblock %} {% block page-title %}{% firstof manager_site_title site_title "Authentic2" %}{% endblock %} diff --git a/src/authentic2/manager/views.py b/src/authentic2/manager/views.py index 3cdcd01c..9bab4a88 100644 --- a/src/authentic2/manager/views.py +++ b/src/authentic2/manager/views.py @@ -20,6 +20,8 @@ from django_tables2 import SingleTableView, SingleTableMixin from django_select2.views import AutoResponseView +from gadjo.templatetags.gadjo import xstatic + from django_rbac.utils import get_ou_model from authentic2.data_transfer import export_site, import_site, DataImportError, ImportContext @@ -50,7 +52,9 @@ class MediaMixin(object): class Media: js = ( reverse_lazy('a2-manager-javascript-catalog'), - 'xstatic/jquery.js', + xstatic('jquery.js', 'jquery.min.js'), + xstatic('jquery-ui.js', 'jquery-ui.min.js'), + 'js/gadjo.js', 'jquery/js/jquery.form.js', 'admin/js/urlify.js', 'authentic2/js/purl.js', -- 2.18.0