From 13215e274fdf80937136fc6fb4265dea57ecfe7a Mon Sep 17 00:00:00 2001 From: Stefane Fermigier Date: Sat, 23 Mar 2024 15:50:04 +0100 Subject: [PATCH] refact: format template. --- src/abilian/web/templates/abilian_base.html | 173 +++++++++++--------- 1 file changed, 92 insertions(+), 81 deletions(-) diff --git a/src/abilian/web/templates/abilian_base.html b/src/abilian/web/templates/abilian_base.html index c942f178..e9dd3788 100644 --- a/src/abilian/web/templates/abilian_base.html +++ b/src/abilian/web/templates/abilian_base.html @@ -1,39 +1,42 @@ {%- set locale = get_locale() -%} - - - - {%- block page_title %}{{ config.SITE_NAME }}{% endblock page_title -%} - - - - - - - {%- assets "css" %} - - {%- endassets %} {%- block css %}{%- endblock css %} - - - + + + {%- block page_title %}{{ config.SITE_NAME }}{% endblock page_title -%} + + + + + + + {%- assets "css" %} + + {%- endassets %} + {%- block css %}{%- endblock css %} + + + - + + href="{{ config['FAVICO_URL'] | string }}"/> - + - {%- assets "js-top" %} + {%- assets "js-top" %} - {%- endassets %} {%- set sentry_url = config.get("SENTRY_SDK_URL") %} {%- - set sentry_dsn = config.get("SENTRY_DSN") %} {%- if sentry_url and - sentry_dsn %} + {%- endassets %} + + {%- set sentry_url = config.get("SENTRY_SDK_URL") %} + {%- set sentry_dsn = config.get("SENTRY_DSN") %} + {%- if sentry_url and sentry_dsn %} - {%- endif %} {%- block top_js %}{%- endblock top_js %} - + {%- endif %} - - {%- block body %} {#- accessibility link: see + {%- block top_js %}{%- endblock top_js %} + + + +{%- block body %} {#- accessibility link: see http://getbootstrap.com/getting-started/#accessibility #} - {{ _("Skip to content") }} + {{ _("Skip to content") }} - - {% include "navbar.html" %} + + {% include "navbar.html" %} -
- - {% if g.breadcrumb|length > 1 %} +
+ + {% if g.breadcrumb|length > 1 %}
{% include "breadcrumbs.html" %}
- {% endif %} + {% endif %} - -
-
{%- include "flash-messages.html" %}
-
+ +
+
{%- include "flash-messages.html" %}
+
-
-
- {% block header %} {%- endblock header %} -
-
+
+
+ {% block header %} {%- endblock header %} +
+
-
-
-
- {% block main %} +
+
+
+ {% block main %}
{% block content %} {% endblock content %}
- {%- endblock main %} -
+ {%- endblock main %}
+
- {%- block footer %} + {%- block footer %} - {%- endblock footer %} {%- endblock body %} {%- assets "js" %} - - {%- endassets %} {%- block js %}{%- endblock js %} {# this block should be + {%- endblock footer %} +{%- endblock body %} + +{%- assets "js" %} + +{%- endassets %} + +{%- block js %}{%- endblock js %} {# this block should be used to load additional libraries #} - - + + - {#- i18n bundles #} {%- set js_i18n_bundle = "js-i18n-" + locale.language %} - {%- if js_i18n_bundle in app.extensions['webassets'] %} - - {%- assets js_i18n_bundle %} +{#- i18n bundles #} {%- set js_i18n_bundle = "js-i18n-" + locale.language %} +{%- if js_i18n_bundle in app.extensions['webassets'] %} + + {%- assets js_i18n_bundle %} - {%- endassets %} {%- endif %} {% block locale_js %} {% endblock locale_js %} - {#- 'abilian_init.js' will load additional libraries by writing new 'script' + {%- endassets %} +{%- endif %} + +{% block locale_js %} {% endblock locale_js %} +{#- 'abilian_init.js' will load additional libraries by writing new 'script' tags. We put deferred JS and inline_js in a separate script tag so that the code is executed after thoses libraries have been loaded. #} - + {#- template can also use an 'inline_js' variable #} + {%- set inline_js = inline_js|default(None) %} + {%- if inline_js %} + {{ inline_js }} + {%- endif %} + - {%- if config.TRACKING_CODE %} {{ config.TRACKING_CODE | safe }} {%- endif - %} - +{%- if config.TRACKING_CODE %} {{ config.TRACKING_CODE | safe }} {%- endif %} +