comparison default/base/base.html @ 26:d782227c088d

base/base.html: generate <script> element and include css.js by default
author Goffi <goffi@goffi.org>
date Sat, 24 Jun 2017 20:22:36 +0200
parents b046a7835374
children 9abef4a23af0
comparison
equal deleted inserted replaced
25:b046a7835374 26:d782227c088d
1 {% set embedded = True %} {# embedded is set to avoid including base.html several times if a generic page is included (e.g. blog/articles.html) #} 1 {% set embedded = True %} {# embedded is set to avoid including base.html several times if a generic page is included (e.g. blog/articles.html) #}
2 {{ script.include('css') }} {# css.js is a common script, so it's useful to import it here #}
2 <!DOCTYPE html> 3 <!DOCTYPE html>
3 <html> 4 <html>
4 <head> 5 <head>
5 <meta charset="utf-8" /> 6 <meta charset="utf-8" />
6 7
7 {% if norobots %} 8 {% if norobots %}
8 <meta name="robots" content="noindex, nofollow"> 9 <meta name="robots" content="noindex, nofollow">
9 {% endif %} 10 {% endif %}
10 11
11 <title>{% block title %}{{C.APP_NAME}}{% endblock %}</title> 12 <title>{% block title %}{{C.APP_NAME}}{% endblock %}</title>
13
12 {% if css_content is defined %} 14 {% if css_content is defined %}
13 <style type="text/css"> 15 <style type="text/css">
14 {{css_content}} 16 {{css_content}}
15 </style> 17 </style>
16 {% else %} 18 {% else %}
17 {% for css_file in css_files %} 19 {% for css_file in css_files %}
18 <link rel='stylesheet' type="text/css" href='{{root_path}}{{css_file}}'> 20 <link rel='stylesheet' type="text/css" href='{{root_path}}{{css_file}}'>
19 {% endfor %} 21 {% endfor %}
20 {% endif %} 22 {% endif %}
23
21 {% if background_image is defined %} 24 {% if background_image is defined %}
22 {# Q&D workaround to implement dynamic background-image 25 {# Q&D workaround to implement dynamic background-image
23 it should be replaced by a better mechanism in the future, avoid using it #} 26 it should be replaced by a better mechanism in the future, avoid using it #}
24 <style type="text/css"> 27 <style type="text/css">
25 html { 28 html {
26 background-image: url('{{background_image}}'); 29 background-image: url('{{background_image}}');
27 background-size: 15em; 30 background-size: 15em;
28 } 31 }
29 </style> 32 </style>
30 {% endif %} 33 {% endif %}
34
35 {{ script.generate_scripts() }}
31 </head> 36 </head>
32 <body> 37 <body>
33 <div id="body"> 38 <div id="body">
34 {% block body %} 39 {% block body %}
35 {% endblock body %} 40 {% endblock body %}