Skip to content

Commit

Permalink
refact: format template.
Browse files Browse the repository at this point in the history
  • Loading branch information
sfermigier committed Mar 23, 2024
1 parent d9c0d33 commit 13215e2
Showing 1 changed file with 92 additions and 81 deletions.
173 changes: 92 additions & 81 deletions src/abilian/web/templates/abilian_base.html
Original file line number Diff line number Diff line change
@@ -1,39 +1,42 @@
{%- set locale = get_locale() -%}
<!doctype html>
<html lang="{{ locale.language }}">
<head>
<meta charset="utf-8" />
<title>
{%- block page_title %}{{ config.SITE_NAME }}{% endblock page_title -%}
</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="description" content="" />
<meta name="author" content="" />

{%- assets "css" %}
<link href="{{ ASSET_URL }}" rel="stylesheet" />
{%- endassets %} {%- block css %}{%- endblock css %}

<!-- Le fav and touch icons -->
<link
<head>
<meta charset="utf-8"/>
<title>
{%- block page_title %}{{ config.SITE_NAME }}{% endblock page_title -%}
</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="description" content=""/>
<meta name="author" content=""/>

{%- assets "css" %}
<link href="{{ ASSET_URL }}" rel="stylesheet"/>
{%- endassets %}
{%- block css %}{%- endblock css %}

<!-- Le fav and touch icons -->
<link
rel="shortcut icon"
type="image/png"
href="{{ config['FAVICO_URL'] | string }}" />
<link
href="{{ config['FAVICO_URL'] | string }}"/>
<link
rel="apple-touch-icon"
type="image/png"
href="{{ config['FAVICO_URL'] | string }}" />
href="{{ config['FAVICO_URL'] | string }}"/>

<script>
var require = {{ app.extensions['webassets'].requirejs_config | tojson }};
</script>
<script>
var require = {{ app.extensions['webassets'].requirejs_config | tojson }};
</script>

{%- assets "js-top" %}
{%- assets "js-top" %}
<script type="text/javascript" src="{{ ASSET_URL }}"></script>
{%- 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 %}
<script src="{{ sentry_url }}" crossorigin="anonymous"></script>
<script>
var dsn = {{ sentry_dsn | tojson }};
Expand All @@ -48,98 +51,106 @@
});
}
</script>
{%- endif %} {%- block top_js %}{%- endblock top_js %}
</head>
{%- endif %}

<body {%- if body_class is defined %} class="{{ body_class }}" {% endif -%}>
{%- block body %} {#- accessibility link: see
{%- block top_js %}{%- endblock top_js %}
</head>

<body {%- if body_class is defined %} class="{{ body_class }}" {% endif -%}>
{%- block body %} {#- accessibility link: see
http://getbootstrap.com/getting-started/#accessibility #}
<a href="#content" class="sr-only">{{ _("Skip to content") }}</a>
<a href="#content" class="sr-only">{{ _("Skip to content") }}</a>

<!-- navbar -->
{% include "navbar.html" %}
<!-- navbar -->
{% include "navbar.html" %}

<div id="content" class="container clearfix">
<!-- breadcrumbs -->
{% if g.breadcrumb|length > 1 %}
<div id="content" class="container clearfix">
<!-- breadcrumbs -->
{% if g.breadcrumb|length > 1 %}
<div class="row">
<div class="col-xs-12">{% include "breadcrumbs.html" %}</div>
</div>
{% endif %}
{% endif %}

<!-- flash messages -->
<div class="row" id="flash-messages">
<div class="col-xs-12">{%- include "flash-messages.html" %}</div>
</div>
<!-- flash messages -->
<div class="row" id="flash-messages">
<div class="col-xs-12">{%- include "flash-messages.html" %}</div>
</div>

<div class="row">
<header class="col-xs-12">
{% block header %} {%- endblock header %}
</header>
</div>
<div class="row">
<header class="col-xs-12">
{% block header %} {%- endblock header %}
</header>
</div>

<div class="row">
<div class="col-xs-12">
<div class="main-block">
{% block main %}
<div class="row">
<div class="col-xs-12">
<div class="main-block">
{% block main %}
<div class="content-block">
{% block content %} {% endblock content %}
</div>
{%- endblock main %}
</div>
{%- endblock main %}
</div>
</div>
</div>
</div>

{%- block footer %}
{%- block footer %}
<footer>
<div class="container">
<div class="row">
<div class="col-xs-12">
<hr />
<hr/>
<p class="text-right">
<small
>Powered by <a href="https://www.abilian.com/">Abilian</a>
>Powered by <a href="https://www.abilian.com/">Abilian</a>
</small>
</p>
</div>
</div>
</div>
</footer>
{%- endblock footer %} {%- endblock body %} {%- assets "js" %}
<script type="text/javascript" src="{{ ASSET_URL }}"></script>
{%- endassets %} {%- block js %}{%- endblock js %} {# this block should be
{%- endblock footer %}
{%- endblock body %}

{%- assets "js" %}
<script type="text/javascript" src="{{ ASSET_URL }}"></script>
{%- endassets %}

{%- block js %}{%- endblock js %} {# this block should be
used to load additional libraries #}

<!-- app init -->
<script type="text/javascript">
{%- include "abilian_init.js" %}
</script>
<!-- app init -->
<script type="text/javascript">
{%- include "abilian_init.js" %}
</script>

{#- i18n bundles #} {%- set js_i18n_bundle = "js-i18n-" + locale.language %}
{%- if js_i18n_bundle in app.extensions['webassets'] %}
<!-- i18n -->
{%- assets js_i18n_bundle %}
{#- i18n bundles #} {%- set js_i18n_bundle = "js-i18n-" + locale.language %}
{%- if js_i18n_bundle in app.extensions['webassets'] %}
<!-- i18n -->
{%- assets js_i18n_bundle %}
<script type="text/javascript" src="{{ ASSET_URL }}"></script>
{%- 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. #}

<script type="text/javascript">
{% deferredJS %}{% enddeferredJS %}
<script type="text/javascript">
{% deferredJS %}{% enddeferredJS %}

{% block inline_js %}
{% endblock inline_js %}
{% block inline_js %}{% endblock inline_js %}

{#- template can also use an 'inline_js' variable #}
{%- set inline_js = inline_js|default(None) %}
{%- if inline_js %}
{{ inline_js }}
{%- endif %}
</script>
{#- template can also use an 'inline_js' variable #}
{%- set inline_js = inline_js|default(None) %}
{%- if inline_js %}
{{ inline_js }}
{%- endif %}
</script>

{%- if config.TRACKING_CODE %} {{ config.TRACKING_CODE | safe }} {%- endif
%}
</body>
{%- if config.TRACKING_CODE %} {{ config.TRACKING_CODE | safe }} {%- endif %}
</body>
</html>

0 comments on commit 13215e2

Please sign in to comment.