comparison 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
comparison
equal deleted inserted replaced
228:3195484abd82 229:739c3e6999fa
1 {# embedded is set to avoid including base.html several times if a generic page is included (e.g. blog/articles.html) #} 1 {# embedded is set to avoid including base.html several times if a generic page is included (e.g. blog/articles.html) #}
2 {% set embedded = True %} 2 {% set embedded = True %}
3 {% import 'components/common.html' as component with context %} 3 {% import 'components/common.html' as component with context %}
4 {{ script.include('common', '') }} {# common.js is, as its name state, a common script, so it's useful to import it here #} 4 {{ script.include('common', '') }} {# common.js is, as its name states, a common script, so it's useful to import it here #}
5 {{ script.include('dom_update') }} {# will check page for dom element to modify when javascript is enabled #} 5 {{ script.include('dom_update') }} {# will check page for dom element to modify when javascript is enabled #}
6 <!DOCTYPE html> 6 <!DOCTYPE html>
7 <html> 7 <html>
8 <head> 8 <head>
9 <meta charset="utf-8"> 9 <meta charset="utf-8">
61 {{ script.include('websocket', '') }} 61 {{ script.include('websocket', '') }}
62 {% endif %} 62 {% endif %}
63 {# FIXME: following ugly hack is temporarily needed for dom_update, until a proper way to handle gettext dynamicly is implemented #} 63 {# FIXME: following ugly hack is temporarily needed for dom_update, until a proper way to handle gettext dynamicly is implemented #}
64 <script>expand_txt="{% trans %}Click to expand…{% endtrans %}"; reduce_txt="{% trans %}Click to reduce…{% endtrans %}";</script> 64 <script>expand_txt="{% trans %}Click to expand…{% endtrans %}"; reduce_txt="{% trans %}Click to reduce…{% endtrans %}";</script>
65 {{ script.generate_scripts() }} 65 {{ script.generate_scripts() }}
66 {% for script in scripts %}
67 <script{{ {'src': script.src, 'type': script.type} | xmlattr }}>{{script.content}}</script>
68 {% endfor %}
66 {% if websocket is defined %} 69 {% if websocket is defined %}
67 <script>var socket=new WSHandler("{{websocket.url}}", "{{websocket.token}}", {{websocket.debug}});</script> 70 <script>var socket=new WSHandler("{{websocket.url}}", "{{websocket.token}}", {{websocket.debug}});</script>
68 {% endif %} 71 {% endif %}
69 72
70 {% block favicon %} 73 {% block favicon %}
71 <link rel="icon" href="{{media_path}}icons/apps/64/sat.png"> 74 <link rel="icon" href="{{media_path}}icons/apps/64/sat.png">
72 {% endblock favicon %} 75 {% endblock favicon %}
73 </head> 76 </head>
74 <body> 77
78 <body{{ {'onload': body_onload} | xmlattr }}>
75 {% if atom_url is defined %} 79 {% if atom_url is defined %}
76 {{ icon_defs('feed') }} 80 {{ icon_defs('feed') }}
77 {% endif %} 81 {% endif %}
78 {% if main_menu %} 82 {% if main_menu %}
79 {% block main_menu %} 83 {% block main_menu %}