| 1 | {# base template managing common layout, blocks, links or scripts |
| 2 | |
| 3 | except for special pages, this template should always be extended. |
| 4 | |
| 5 | @variable menu_fixed_top(bool): if true, the menu will always stay on top, and padding will be added to body accordingly. |
| 6 | #} |
| 7 | |
| 8 | |
| 9 | {# embedded is set to avoid including base.html several times if a generic page is included (e.g. blog/articles.html) #} |
| 10 | {% set embedded = True %} |
| 11 | {% import 'components/common.html' as component with context %} |
| 12 | {{ script.include('common', '') }} {# common.js is, as its name states, a common script, so it's useful to import it here #} |
| 13 | <!DOCTYPE html> |
| 14 | <html> |
| 15 | <head> |
| 16 | <meta charset="utf-8"> |
| 17 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 18 | {# using SVG directly doesn't always play well with Bulma, so we also use the icon font #} |
| 19 | <link rel='stylesheet' type="text/css" href='{{build_path}}node_modules/@fortawesome/fontawesome-free/css/all.min.css'> |
| 20 | <link rel='stylesheet' type="text/css" href='{{build_path}}node_modules/bulma/css/bulma.min.css'> |
| 21 | |
| 22 | {% if norobots %} |
| 23 | <meta name="robots" content="noindex, nofollow"> |
| 24 | {% endif %} |
| 25 | |
| 26 | <title>{% block title %}{{C.APP_NAME}}{% endblock %}</title> |
| 27 | |
| 28 | {% if css_content is defined %} |
| 29 | <style type="text/css"> |
| 30 | {{css_content}} |
| 31 | </style> |
| 32 | {% if css_content_noscript is defined %} |
| 33 | <noscript> |
| 34 | <style type="text/css"> |
| 35 | {{css_content_noscript}} |
| 36 | </style> |
| 37 | </noscript> |
| 38 | {% endif %} |
| 39 | {% else %} |
| 40 | {% for css_file in css_files %} |
| 41 | <link rel='stylesheet' type="text/css" href='{{css_file}}'> |
| 42 | {% endfor %} |
| 43 | {% if css_files_noscript %} |
| 44 | <noscript> |
| 45 | {% for css_file in css_files_noscript %} |
| 46 | <link rel='stylesheet' type="text/css" href='{{css_file}}'> |
| 47 | {% endfor %} |
| 48 | </noscript> |
| 49 | {% endif %} |
| 50 | {% endif %} |
| 51 | |
| 52 | {% if links is defined %} |
| 53 | {% for link_data in links %} |
| 54 | <link{{link_data|xmlattr}}> |
| 55 | {% endfor %} |
| 56 | {% endif %} |
| 57 | |
| 58 | {% if xmpp_uri is defined %} |
| 59 | <link rel="alternate" type="application/atom+xml" href="{{xmpp_uri}}" > |
| 60 | {% endif %} |
| 61 | |
| 62 | {% if dynamic_style is defined %} |
| 63 | {# be extra careful about dynamic style, insure escaping if you use untrusted values ! #} |
| 64 | <style type="text/css"> |
| 65 | {{dynamic_style}} |
| 66 | </style> |
| 67 | {% endif %} |
| 68 | |
| 69 | {% if csrf_token is defined %} |
| 70 | <script>var csrf_token = "{{csrf_token}}"; var session_uuid="{{session_uuid}}";</script> |
| 71 | {% endif %} |
| 72 | |
| 73 | {% if websocket is defined %} |
| 74 | <script>var ws_url = "{{websocket.url}}"; var ws_token="{{websocket.token}}"; var ws_debug={{websocket.debug}};</script> |
| 75 | {% endif %} |
| 76 | |
| 77 | {{ script.generate_scripts() }} |
| 78 | |
| 79 | {% for script in scripts %} |
| 80 | <script{{ {'src': script.src, 'type': script.type} | xmlattr }}>{{script.content|safe}}</script> |
| 81 | {% endfor %} |
| 82 | |
| 83 | |
| 84 | {% block favicon %} |
| 85 | <link rel="icon" href="{{media_path}}icons/apps/64/sat.png"> |
| 86 | {% endblock favicon %} |
| 87 | </head> |
| 88 | <body{{ {'onload': body_onload} | xmlattr }} class="{{' body--fullscreen' if full_screen_body}}{{' has-navbar-fixed-top' if menu_fixed_top}}"> |
| 89 | {% if atom_url is defined %} |
| 90 | {{ icon_defs('rss') }} |
| 91 | {% endif %} |
| 92 | {% if loading_screen %} |
| 93 | <div id="loading_screen" class="modal is-active"> |
| 94 | <div class="modal-background"></div> |
| 95 | <div class="modal-content"> |
| 96 | <div class="notification has-text-centered"> |
| 97 | <div class="is-flex is-align-items-center is-justify-content-center"> |
| 98 | <span class="icon is-large"> |
| 99 | <i class="fa-solid fa-spinner fa-spin fa-xl"></i> |
| 100 | </span> |
| 101 | <span class=""> |
| 102 | {% trans %}page is loading, please wait…{% endtrans %} |
| 103 | </span> |
| 104 | </div> |
| 105 | </div> |
| 106 | </div> |
| 107 | </div> |
| 108 | {% endif %} |
| 109 | {% if main_menu %} |
| 110 | {% block main_menu %} |
| 111 | {{ component.menu(main_menu) }} |
| 112 | {% endblock main_menu %} |
| 113 | {% endif %} |
| 114 | {% block body_wrapper %} |
| 115 | <div id="body"> |
| 116 | {% if breadcrumbs and not no_breadcrumps and breadcrumbs|length > 1 %} |
| 117 | <nav class="breadcrumb is-medium" aria-label="breadcrumbs"> |
| 118 | <ul> |
| 119 | {% for crumb in breadcrumbs %} |
| 120 | <li {% if loop.last %}class="is-active"{% endif %}> |
| 121 | <a href="{{crumb.url or '#'}}"> |
| 122 | {% if crumb.icon %} |
| 123 | <span class="icon is-medium"> |
| 124 | <i class="icon-{{crumb.icon}}"></i> |
| 125 | </span> |
| 126 | {% endif %} |
| 127 | <span>{{crumb.label}}</span> |
| 128 | </a> |
| 129 | </li> |
| 130 | {% endfor %} |
| 131 | </ul> |
| 132 | </nav> |
| 133 | {% endif %} |
| 134 | {% if confirm %} |
| 135 | <article class="message is-success mt-4"> |
| 136 | <div class="message-header"> |
| 137 | {% trans %}Success{% endtrans %} |
| 138 | <button class="delete" aria-label="delete" onclick="this.parentElement.parentElement.remove()"></button> |
| 139 | </div> |
| 140 | <div class="message-body"> |
| 141 | {% trans %}Your data has been sent correctly.{% endtrans %} |
| 142 | </div> |
| 143 | </article> |
| 144 | {% endif %} |
| 145 | {% if notifications %} |
| 146 | {% for notification in notifications %} |
| 147 | <article class="message {{ {C.LVL_WARNING: "is-warning"}.get(notification.level, "is-info") }} mt-4"> |
| 148 | <div class="message-header"> |
| 149 | {% trans %}Notification{% endtrans %} |
| 150 | <button class="delete" aria-label="delete" onclick="this.parentElement.parentElement.remove()"></button> |
| 151 | </div> |
| 152 | <div class="message-body"> |
| 153 | {{ notification.message }} |
| 154 | </div> |
| 155 | </article> |
| 156 | {% endfor %} |
| 157 | {% endif %} |
| 158 | <div id="notifs_area"></div> |
| 159 | {% block body %} |
| 160 | {% endblock body %} |
| 161 | </div> |
| 162 | {% endblock body_wrapper%} |
| 163 | {% block footer %} |
| 164 | {% endblock footer %} |
| 165 | </body> |
| 166 | </html> |