la-chariotte/la_chariotte/templates/base.html
2023-05-25 15:41:49 +02:00

153 lines
No EOL
4.9 KiB
HTML

{% load static %}
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:type" content="website">
<meta property="og:locale" content="fr_FR" />
<meta property="og:site_name" content="La chariotte">
<meta property="og:url" content="{{ BASE_URL }}{{ request.path }}">
<title>{% block title %}{% endblock %} - La Chariotte</title>
{% block css %}
<link rel="stylesheet" href="{% static 'css/app.css' %}">
{% block extra_css %}{% endblock extra_css %}
{% endblock css %}
<link rel="shortcut icon" href="{% static 'img/icons/chariotte.ico' %}">
</head>
<body>
<main>
<!-- Top navbar -->
<nav class="top-nav navbar">
<!-- Navbar brand : always visible (all screen sizes)-->
<div class="navbar-brand">
<p class="navbar-item is-size-4 has-text-weight-semibold">
{% block content_title %}Bienvenue :){% endblock %}
</p>
</div>
<div class="navbar-menu">
<div class="navbar-end">
<div class="navbar-item">
<div class="buttons">
{% if user.is_authenticated %}
<p class="mr-4">{{ user.get_full_name }}</p>
<a class="button is-light" href="{% url 'accounts:logout' %}">
Se déconnecter
</a>
{% else %}
<a class="button is-light" href="{% url 'accounts:signup' %}">
<strong>Créer un compte</strong>
</a>
<a class="button is-primary" href="{% url 'accounts:login' %}">
Se connecter
</a>
{% endif %}
</div>
</div>
</div>
</div>
</nav>
<!-- End Top navbar -->
<!-- Side navbar -->
<nav class="side-nav navbar is-fixed-top is-flex-desktop" role="navigation" aria-label="main navigation">
<!-- Navbar brand : always visible (all screen sizes)-->
<div class="navbar-brand">
<a class="navbar-item" href="{% url 'home' %}">
<img src="{% static 'img/logos/logo_la_chariotte.png' %}">
</a>
{% if user.is_authenticated %}
<div class="navbar-item desktop-hidden">
<a class="button is-light" href="{% url 'order:index' %}">
Mes commandes
</a>
</div>
{% endif %}
<a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="navbarBasicExample">
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
</a>
</div>
<!-- Navbar menu : only visible on desktop-->
<div id="navbarBasicExample" class="navbar-menu">
<div class="navbar-start">
<a class="navbar-item" href="{% url 'home' %}">
Accueil
</a>
{% if user.is_authenticated %}
<a class="navbar-item" href="{% url 'order:index' %}">
Mes commandes
</a>
<a class="navbar-item" href="{% url 'order:create_grouped_order' %}">
Créer une commande groupée
</a>
{% endif %}
<a class="navbar-item" href="{% url 'join_grouped_order' %}">
Rejoindre une commande groupée
</a>
<a class="navbar-item" href="{% url 'notice' %}">
Comment ça marche ?
</a>
</div>
<hr>
<div class="navbar-item desktop-hidden">
<div class="buttons">
{% if user.is_authenticated %}
<a class="button is-light" href="{% url 'accounts:logout' %}">
Se déconnecter
</a>
{% else %}
<a class="button is-light" href="{% url 'accounts:signup' %}">
<strong>Créer un compte</strong>
</a>
<a class="button is-primary" href="{% url 'accounts:login' %}">
Se connecter
</a>
{% endif %}
</div>
</div>
</div>
</nav>
<!-- End Navbar -->
<div class="content">
{% block content %}
{% endblock %}
</div>
</main>
</body>
</html>
<script>
// For responsive menu
document.addEventListener('DOMContentLoaded', () => {
// Get all "navbar-burger" elements
const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);
// Add a click event on each of them
$navbarBurgers.forEach( el => {
el.addEventListener('click', () => {
// Get the target from the "data-target" attribute
const target = el.dataset.target;
const $target = document.getElementById(target);
// Toggle the "is-active" class on both the "navbar-burger" and the "navbar-menu"
el.classList.toggle('is-active');
$target.classList.toggle('is-active');
});
});
});
{% block extra_js %}{% endblock %}
</script>