diff sat_templates/templates/default/base/base.html @ 229:739c3e6999fa

base: `scripts` variable can be used to create suitable tags + new `body_onload` variable
author Goffi <goffi@goffi.org>
date Sun, 26 Apr 2020 22:06:07 +0200
parents b2f0f81b2cd2
children caa3767707fb
line wrap: on
line diff
--- a/sat_templates/templates/default/base/base.html	Sun Apr 19 22:48:57 2020 +0200
+++ b/sat_templates/templates/default/base/base.html	Sun Apr 26 22:06:07 2020 +0200
@@ -1,7 +1,7 @@
  {# embedded is set to avoid including base.html several times if a generic page is included (e.g. blog/articles.html) #}
 {% set embedded = True %}
 {% import 'components/common.html' as component with context %}
-{{ script.include('common', '') }} {# common.js is, as its name state, a common script, so it's useful to import it here #}
+{{ script.include('common', '') }} {# common.js is, as its name states, a common script, so it's useful to import it here #}
 {{ script.include('dom_update') }} {# will check page for dom element to modify when javascript is enabled #}
 <!DOCTYPE html>
 <html>
@@ -63,6 +63,9 @@
     {# FIXME: following ugly hack is temporarily needed for dom_update, until a proper way to handle gettext dynamicly is implemented #}
     <script>expand_txt="{% trans %}Click to expand…{% endtrans %}"; reduce_txt="{% trans %}Click to reduce…{% endtrans %}";</script>
     {{ script.generate_scripts() }}
+    {% for script in scripts %}
+        <script{{ {'src': script.src, 'type': script.type} | xmlattr }}>{{script.content}}</script>
+    {% endfor %}
     {% if websocket is defined %}
         <script>var socket=new WSHandler("{{websocket.url}}", "{{websocket.token}}", {{websocket.debug}});</script>
     {% endif %}
@@ -71,7 +74,8 @@
         <link rel="icon" href="{{media_path}}icons/apps/64/sat.png">
     {% endblock favicon %}
 </head>
-<body>
+
+<body{{ {'onload': body_onload} | xmlattr }}>
     {% if atom_url is defined %}
         {{ icon_defs('feed') }}
     {% endif %}