| 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 %} |
| 3 | {% import 'components/common.html' as component with context %} |
| 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 #} |
| 6 | <!DOCTYPE html> |
| 7 | <html> |
| 8 | <head> |
| 9 | <meta charset="utf-8"> |
| 10 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 11 | |
| 12 | {% if norobots %} |
| 13 | <meta name="robots" content="noindex, nofollow"> |
| 14 | {% endif %} |
| 15 | |
| 16 | <title>{% block title %}{{C.APP_NAME}}{% endblock %}</title> |
| 17 | |
| 18 | {% if css_content is defined %} |
| 19 | <style type="text/css"> |
| 20 | {{css_content}} |
| 21 | </style> |
| 22 | {% if css_content_noscript is defined %} |
| 23 | <noscript> |
| 24 | <style type="text/css"> |
| 25 | {{css_content_noscript}} |
| 26 | </style> |
| 27 | </noscript> |
| 28 | {% endif %} |
| 29 | {% else %} |
| 30 | {% for css_file in css_files %} |
| 31 | <link rel='stylesheet' type="text/css" href='{{css_file}}'> |
| 32 | {% endfor %} |
| 33 | {% if css_files_noscript %} |
| 34 | <noscript> |
| 35 | {% for css_file in css_files_noscript %} |
| 36 | <link rel='stylesheet' type="text/css" href='{{css_file}}'> |
| 37 | {% endfor %} |
| 38 | </noscript> |
| 39 | {% endif %} |
| 40 | {% endif %} |
| 41 | |
| 42 | {% if links is defined %} |
| 43 | {% for link_data in links %} |
| 44 | <link{{link_data|xmlattr}}> |
| 45 | {% endfor %} |
| 46 | {% endif %} |
| 47 | |
| 48 | {% if xmpp_uri is defined %} |
| 49 | <link rel="alternate" type="application/atom+xml" href="{{xmpp_uri}}" > |
| 50 | {% endif %} |
| 51 | |
| 52 | {% if dynamic_style is defined %} |
| 53 | {# be extra careful about dynamic style, insure escaping if you use untrusted values ! #} |
| 54 | <style type="text/css"> |
| 55 | {{dynamic_style}} |
| 56 | </style> |
| 57 | {% endif %} |
| 58 | |
| 59 | {# JS handling #} |
| 60 | {% if csrf_token is defined %} |
| 61 | <script>var csrf_token = "{{csrf_token}}";</script> |
| 62 | {% endif %} |
| 63 | {% if websocket is defined %} |
| 64 | {{ script.include('websocket', '') }} |
| 65 | {% endif %} |
| 66 | {# FIXME: following ugly hack is temporarily needed for dom_update, until a proper way to handle gettext dynamicly is implemented #} |
| 67 | <script>expand_txt="{% trans %}Click to expand…{% endtrans %}"; reduce_txt="{% trans %}Click to reduce…{% endtrans %}";</script> |
| 68 | {{ script.generate_scripts() }} |
| 69 | {% for script in scripts %} |
| 70 | <script{{ {'src': script.src, 'type': script.type} | xmlattr }}>{{script.content|safe}}</script> |
| 71 | {% endfor %} |
| 72 | {% if websocket is defined %} |
| 73 | <script>var socket=new WSHandler("{{websocket.url}}", "{{websocket.token}}", {{websocket.debug}});</script> |
| 74 | {% endif %} |
| 75 | |
| 76 | {% block favicon %} |
| 77 | <link rel="icon" href="{{media_path}}icons/apps/64/sat.png"> |
| 78 | {% endblock favicon %} |
| 79 | </head> |
| 80 | |
| 81 | <body{{ {'onload': body_onload} | xmlattr }}> |
| 82 | {% if atom_url is defined %} |
| 83 | {{ icon_defs('feed') }} |
| 84 | {% endif %} |
| 85 | {% if main_menu %} |
| 86 | {% block main_menu %} |
| 87 | {% call component.menu(main_menu, class="main_menu") %} |
| 88 | <form action="" method="get" class="menu__language"> |
| 89 | <select name="{{C.KEY_LANG}}" id="{{C.KEY_LANG}}" onchange="this.form.submit()"> |
| 90 | {% if locales|length>1 %} |
| 91 | {% for l in locales %} |
| 92 | <option value="{{l}}" {{"selected" if l==locale}}> |
| 93 | {{l.language_name}} |
| 94 | </option> |
| 95 | {% endfor %} |
| 96 | {% endif %} |
| 97 | </select> |
| 98 | <button type="submit" class="menu__language-btn"> |
| 99 | {% trans %}change{% endtrans %} |
| 100 | </button> |
| 101 | </form> |
| 102 | {% endcall %} |
| 103 | {% endblock main_menu %} |
| 104 | {% endif %} |
| 105 | |
| 106 | <main id='main_area'> |
| 107 | <header> |
| 108 | {% if confirm %} |
| 109 | {# confirmation message used when post data has been handled correctly #} |
| 110 | {% block confirm %} |
| 111 | <div class="box post_confirm"> |
| 112 | {% block confirm_message %} |
| 113 | {% trans %}Your data has been sent correctly.{% endtrans %} |
| 114 | {% endblock confirm_message %} |
| 115 | </div> |
| 116 | {% endblock confirm %} |
| 117 | {% endif %} |
| 118 | {% if notifications %} |
| 119 | {% block notifications %} |
| 120 | {% for notification in notifications %} |
| 121 | <div class="box notification notification--{{notification.level}}"> |
| 122 | {{ notification.message }} |
| 123 | </div> |
| 124 | {% endfor %} |
| 125 | {% endblock notifications %} |
| 126 | {% endif %} |
| 127 | |
| 128 | </header> |
| 129 | |
| 130 | <div id="body"> |
| 131 | {% block category_menu scoped %} |
| 132 | {% if category_menu is defined %} |
| 133 | {{ component.menu(category_menu, class="category_menu") }} |
| 134 | {% endif %} |
| 135 | {% endblock category_menu %} |
| 136 | {% block body %} |
| 137 | {% endblock body %} |
| 138 | </div> |
| 139 | <footer class="page__footer"> |
| 140 | {% block footer %} |
| 141 | <span> |
| 142 | {% trans app_name=C.APP_NAME %}Powered by {{app_name}}{% endtrans %} |
| 143 | {% if atom_url is defined %} |
| 144 | – |
| 145 | <a href="{{atom_url}}" class="text--clickable"> |
| 146 | {% trans %}subscribe{% endtrans %} {{ icon('feed', cls='icon--text')}} |
| 147 | </a> |
| 148 | {% endif %} |
| 149 | </span> |
| 150 | {% endblock %} |
| 151 | </footer> |
| 152 | </main> |
| 153 | </body> |
| 154 | </html> |