From 3a6b18485c44912a14a70f2244910a9ac52cd56b Mon Sep 17 00:00:00 2001
From: Hanne Moa <hanne.moa@uninett.no>
Date: Tue, 25 Oct 2016 14:22:30 +0200
Subject: [PATCH] Support loading jquery, if turned on

---
 templates/base.twig | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/templates/base.twig b/templates/base.twig
index c97e51c7d..4479d27fb 100644
--- a/templates/base.twig
+++ b/templates/base.twig
@@ -6,7 +6,9 @@
     <title>{{ pagetitle }}</title>
     <link rel="stylesheet" type="text/css" href="/{{ baseurlpath }}resources/default.css">
     <link rel="icon" type="image/icon" href="/{{ baseurlpath }}resources/icons/favicon.ico">
-    <link rel="stylesheet" media="screen" type="text/css" href="/{{ baseurlpath }}resources/uitheme1.8/jquery-ui.css">
+    {% if jquery and jquery.css %}
+    <link rel="stylesheet" media="screen" type="text/css" href="/{{ baseurlpath }}resources/uitheme1.8/jquery-ui.css" />
+    {% endif %}
     {% if isRTL %}<link rel="stylesheet" type="text/css" href="/{{ baseurlpath }}resources/default-rtl.css" />{% endif %}
     <meta name="robots" content="noindex, nofollow">
     {% block preload %}{% endblock %}
@@ -28,6 +30,20 @@
 
     <!-- postload javascript -->
     <script type="text/javascript" src="/{{ baseurlpath }}resources/script.js"></script>
+    {% if jquery %}
+    {% set version = '1.8' %}
+    {% if jquery.version %}
+    {% set version = jquery.version %}
+    {% endif %}
+    {% if version = '1.8' %}
+    {% if jquery.core %}
+    <script type="text/javascript" src="/{{ baseurlpath }}resources/jquery-1.8.js"></script>
+    {% endif %}
+    {% if jquery.ui %}
+    <script type="text/javascript" src="/{{ baseurlpath }}resources/jquery-ui-1.8.js"></script>
+    {% endif %}
+    {% endif %}
+    {% endif %}
     {% if clipboard %}
     <script type="text/javascript" src="/{{ baseurlpath }}resources/clipboard.min.js"></script>
     {% endif %}
-- 
GitLab