From b59a717255d18d51cc93cd139091538115a87a8d Mon Sep 17 00:00:00 2001 From: Dorian Lesbre <dorian.lesbre@gmail.com> Date: Tue, 2 Mar 2021 18:46:00 +0100 Subject: [PATCH] Switched to url in templates --- home/templates/activites.html | 2 ++ home/templates/base.html | 26 +++++++++++++------------- home/templates/faq.html | 2 ++ home/templates/home.html | 2 ++ home/templates/inscription.html | 2 ++ home/templates/registration/login.html | 3 +++ 6 files changed, 24 insertions(+), 13 deletions(-) diff --git a/home/templates/activites.html b/home/templates/activites.html index 9a629ad..d126df3 100644 --- a/home/templates/activites.html +++ b/home/templates/activites.html @@ -1,5 +1,7 @@ {% extends "base.html" %} +{% block nav_activite %}current{% endblock %} + {% block "content" %} <h2>Activités</h2> <p>Durant tout l'événement, des jeux seront en libre-service et des tables disponibles pour jouer. diff --git a/home/templates/base.html b/home/templates/base.html index bf3dc55..bb835f0 100644 --- a/home/templates/base.html +++ b/home/templates/base.html @@ -8,7 +8,7 @@ <title>Interludes 2021</title> <meta name="description" content="Inscriptions et infos sur les interENS ludiques, édition 2021"> <meta name="keywords" content="Interludes ENS événement COF 2021 InterENS"> - <link rel="icon" type="image/png" href="/static/imgs/favicon.ico"/> + <link rel="icon" type="image/png" href="{% static 'imgs/favicon.ico' %}"> <link rel="stylesheet" type="text/css" href="{% static 'css/style.css' %}"> </head> @@ -24,30 +24,30 @@ </header> <nav> - <a href="/" rel="text/html" - class={% if request.path == "/" %}"current"{% else %}"internal"{% endif %}> + <a href="{% url 'home' %}" rel="text/html" + class="{% block nav_home %}{% endblock %}"> Accueil </a> - <a href="/inscription/" rel="text/html" - class={% if request.path == "/inscription/" %}"current"{% else %}"internal"{% endif %}> + <a href="{% url 'inscription' %}" rel="text/html" + class="{% block nav_inscription %}{% endblock %}"> Inscriptions </a> - <a href="/activites/" rel="text/html" - class={% if request.path == "/activites/" %}"current"{% else %}"internal"{% endif %}> + <a href="{% url 'activites' %}" rel="text/html" + class="{% block nav_activite %}{% endblock %}"> Activités </a> - <a href="/faq/" rel="text/html" - class={% if request.path == "/faq/" %}"current"{% else %}"internal"{% endif %}> + <a href="{% url 'FAQ' %}" rel="text/html" + class="{% block nav_faq %}{% endblock %} "> FAQ </a> {% if request.user.is_authenticated %} - <a href="{% url "accounts:logout" %}" - class={% if request.path == "/accounts/logout/" %}"logout current"{% else %}"logout"{% endif %}> + <a href="{% url 'accounts:logout' %}" + class="{% block nav_logout %}{% endblock %} "> Déconnexion </a> {% else %} - <a href="{% url "accounts:login" %}" - class={% if request.path == "/accounts/login/" %}"login current"{% else %}"login"{% endif %}> + <a href="{% url 'accounts:login' %}" + class="{% block nav_login %}{% endblock %} "> Connexion </a> {% endif %} diff --git a/home/templates/faq.html b/home/templates/faq.html index 8b3fb67..885e938 100644 --- a/home/templates/faq.html +++ b/home/templates/faq.html @@ -1,5 +1,7 @@ {% extends "base.html" %} +{% block nav_faq %}current{% endblock %} + {% block "content" %} <h2>Une question ?</h2> <p>Une réponse</p> diff --git a/home/templates/home.html b/home/templates/home.html index 96fef1f..398b90f 100644 --- a/home/templates/home.html +++ b/home/templates/home.html @@ -1,5 +1,7 @@ {% extends "base.html" %} +{% block nav_home %}current{% endblock %} + {% block "content" %} <h2>Présentation</h2> <p> diff --git a/home/templates/inscription.html b/home/templates/inscription.html index 4817b19..1411c52 100644 --- a/home/templates/inscription.html +++ b/home/templates/inscription.html @@ -1,5 +1,7 @@ {% extends "base.html" %} +{% block nav_inscription %}current{% endblock %} + {% block "content" %} <h2>Inscriptions</h2> <p> diff --git a/home/templates/registration/login.html b/home/templates/registration/login.html index af97484..58bf9ad 100644 --- a/home/templates/registration/login.html +++ b/home/templates/registration/login.html @@ -1,5 +1,7 @@ {% extends "base.html" %} +{% block nav_login %}current{% endblock %} + {% block "content" %} <div id="content-area"> {% if form.errors %} @@ -27,6 +29,7 @@ <td>{{ form.password }}</td> </tr> </table> + <br> <input type="submit" value="connexion" /> <input type="hidden" name="next" value="{{ next }}" /> -- GitLab