comparison sat_templates/templates/default/base/base.html @ 237:caa3767707fb

base/base.html: expose CSRF token to script + fixed script content
author Goffi <goffi@goffi.org>
date Fri, 19 Jun 2020 17:57:01 +0200
parents 739c3e6999fa
children
comparison
equal deleted inserted replaced
236:7345ccb7f9df 237:caa3767707fb
55 {{dynamic_style}} 55 {{dynamic_style}}
56 </style> 56 </style>
57 {% endif %} 57 {% endif %}
58 58
59 {# JS handling #} 59 {# JS handling #}
60 {% if csrf_token is defined %}
61 <script>var csrf_token = "{{csrf_token}}";</script>
62 {% endif %}
60 {% if websocket is defined %} 63 {% if websocket is defined %}
61 {{ script.include('websocket', '') }} 64 {{ script.include('websocket', '') }}
62 {% endif %} 65 {% endif %}
63 {# FIXME: following ugly hack is temporarily needed for dom_update, until a proper way to handle gettext dynamicly is implemented #} 66 {# 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> 67 <script>expand_txt="{% trans %}Click to expand…{% endtrans %}"; reduce_txt="{% trans %}Click to reduce…{% endtrans %}";</script>
65 {{ script.generate_scripts() }} 68 {{ script.generate_scripts() }}
66 {% for script in scripts %} 69 {% for script in scripts %}
67 <script{{ {'src': script.src, 'type': script.type} | xmlattr }}>{{script.content}}</script> 70 <script{{ {'src': script.src, 'type': script.type} | xmlattr }}>{{script.content|safe}}</script>
68 {% endfor %} 71 {% endfor %}
69 {% if websocket is defined %} 72 {% if websocket is defined %}
70 <script>var socket=new WSHandler("{{websocket.url}}", "{{websocket.token}}", {{websocket.debug}});</script> 73 <script>var socket=new WSHandler("{{websocket.url}}", "{{websocket.token}}", {{websocket.debug}});</script>
71 {% endif %} 74 {% endif %}
72 75