Files
recipes/cookbook/templates/base.html
2024-12-19 21:16:15 +01:00

170 lines
5.8 KiB
HTML

{% load static %}
{% load i18n %}
{% load theming_tags %}
{% load custom_tags %}
{% theme_values request as theme_values %}
<!DOCTYPE html>
<html>
<head>
<title>{% block title %}
{% endblock %}</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover">
<meta name="robots" content="noindex,nofollow"/>
<link rel="icon" href="{{ theme_values.logo_color_svg }}">
<link rel="icon" href="{{ theme_values.logo_color_32 }}" sizes="32x32">
<link rel="icon" href="{{ theme_values.logo_color_128 }}" sizes="128x128">
<link rel="icon" href="{{ theme_values.logo_color_192 }}" sizes="192x192">
<link rel="apple-touch-icon" href="{{ theme_values.logo_color_180 }}" sizes="180x180">
<link rel="manifest" crossorigin="use-credentials" href="{% url 'web_manifest' %}">
<meta name="msapplication-TileColor" content="{{ theme_values.nav_bg_color }}">
<meta name="msapplication-TileImage" content="{{ theme_values.logo_color_144 }}">
<meta name="theme-color" content="{{ theme_values.nav_bg_color }}">
<meta name="apple-mobile-web-app-capable" content="yes"/>
<!-- Bootstrap 4 -->
<link id="id_main_css" href="{{ theme_values.theme }}" rel="stylesheet">
{% if theme_values.custom_theme %}
<link id="id_custom_css" href="{{ theme_values.custom_theme }}" rel="stylesheet">
{% endif %}
<link href="{% static 'css/app.min.css' %}" rel="stylesheet">
<script src="{% static 'js/jquery-3.5.1.min.js' %}"></script>
<script src="{% static 'js/popper.min.js' %}"></script>
<script src="{% static 'js/bootstrap.min.js' %}"></script>
<!-- Select2 for use with django autocomplete light -->
<link href="{% static 'css/select2.min.css' %}" rel="stylesheet"/>
<script src="{% static 'js/select2.min.js' %}"></script>
<!-- Bootstrap theme for select2 -->
<link rel="stylesheet" href="{% static 'css/select2-bootstrap.css' %}"/>
<link rel="stylesheet" href="{% static 'themes/select2-bootstrap-theme.css' %}"/>
<!-- Fontawesome icons -->
<link rel="stylesheet" href="{% static "fontawesome/fontawesome_all.min.css" %}">
{% block extra_head %} <!-- block for templates to put stuff into header -->
{% endblock %}
</head>
<body>
<nav class="navbar navbar-expand-lg {{ theme_values.nav_text_class }}"
id="id_main_nav"
style="{{ theme_values.sticky_nav }}; background-color: {{ theme_values.nav_bg_color }}">
{% if not request.user.userpreference.left_handed %}
{% if not request.user.is_authenticated or request.user.userpreference.nav_show_logo %}
<a class="navbar-brand p-0 me-2 justify-content-center" href="{% base_path request 'base' %}"
aria-label="Tandoor">
<img class="brand-icon" src="{{ theme_values.nav_logo }}" alt="Logo">
</a>
{% endif %}
{% endif %}
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarText"
aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
</nav>
<div class="container-fluid mt-2 mt-md-3 mt-xl-3 mt-lg-3{% if request.user.userpreference.left_handed %} left-handed {% endif %}"
id="id_base_container">
<div class="row">
<div class="col-xl-2 d-none d-xl-block">
{% block content_xl_left %}
{% endblock %}
</div>
<div class="col-xl-8 col-12">
{% for message in messages %}
<div class="row">
<div class="col col-md-12">
<div class="alert alert-{{ message.tags }} alert-dismissible fade show" role="alert">
{{ message }}
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
</div>
</div>
{% endfor %}
{% block content %}
{% endblock %}
</div>
<div class="col-xl-2 d-none d-xl-block">
{% block content_xl_right %}
{% endblock %}
</div>
</div>
{% block content_fluid %}
{% endblock %}
{% user_prefs request as prefs %}
{{ prefs|json_script:'user_preference' }}
</div>
{% block script %}
{% endblock script %}
<script type="application/javascript">
localStorage.setItem('SCRIPT_NAME', "{% base_path request 'script' %}")
localStorage.setItem('BASE_PATH', "{% base_path request 'base' %}")
localStorage.setItem('STATIC_URL', "{% base_path request 'static_base' %}")
localStorage.setItem('DEBUG', "{% is_debug %}")
localStorage.setItem('USER_ID', "{{request.user.pk}}")
window.addEventListener("load", () => {
if ("serviceWorker" in navigator) {
navigator.serviceWorker.register("{% url 'service_worker' %}", {scope: "{% base_path request 'base' %}" + '/'}).then(function (reg) {
}).catch(function (err) {
console.warn('Error whilst registering service worker', err);
});
} else {
console.warn('service worker not in navigator');
}
});
</script>
<style>
@media screen and (max-width: 1000px) {
.navbar-collapse {
max-height: 60vh;
overflow-y: auto;
overflow-x: hidden;
}
.collapsing {
overflow-y: hidden;
overflow-x: hidden;
}
}
#id_base_container {
padding-bottom: env(safe-area-inset-bottom);
}
.fixed-bottom {
padding-bottom: max(0.5rem, calc(env(safe-area-inset-bottom) - 0.5rem)) !important;
}
</style>
</body>
</html>