Add navbar

This commit is contained in:
Valentin Moguérou 2024-05-08 04:21:21 +02:00
parent 04ced9a731
commit 47479268e0
7 changed files with 141 additions and 37 deletions

View File

@ -6,8 +6,6 @@
{% block title %}Marketplace{% endblock title %} {% block title %}Marketplace{% endblock title %}
{% block main %} {% block main %}
<a href="{% url "colloscope.dashboard" %}">Retour au tableau de bord</a>
<h1>Marketplace</h1> <h1>Marketplace</h1>
Bienvenue sur le marketplace. Bienvenue sur le marketplace.

View File

@ -2,12 +2,10 @@
{% block title %}Sélection du profil{% endblock title %} {% block title %}Sélection du profil{% endblock title %}
{% block header %}
<h1>Sélection du profil</h1>
{% endblock header %}
{% block main %} {% block main %}
<h1>Sélection du profil</h1>
Vous êtes connecté. Votre compte correspond à deux profils : Vous êtes connecté. Votre compte correspond à deux profils :
<ul> <ul>
<li>en tant que colleur : {{ profil.colleur }}&nbsp;; Classes : {{ profil.colleur.get_classes|join:"; " }}</li> <li>en tant que colleur : {{ profil.colleur }}&nbsp;; Classes : {{ profil.colleur.get_classes|join:"; " }}</li>

View File

@ -9,12 +9,8 @@
<link href="{% static 'table.css' %}" rel="stylesheet" type="text/css"> <link href="{% static 'table.css' %}" rel="stylesheet" type="text/css">
{% endblock head %} {% endblock head %}
{% block header %}
<h1>Colloscope</h1>
{% endblock header %}
{% block main %} {% block main %}
<h1>Colloscope</h1>
<p> <p>
Lycée : {{ term.cls.school.description }}. Classe : {{ term.cls.description }}. <a href="dashboard.html">Retour au tableau de bord</a> Lycée : {{ term.cls.school.description }}. Classe : {{ term.cls.description }}. <a href="dashboard.html">Retour au tableau de bord</a>

View File

@ -2,12 +2,10 @@
{% block title %}Sélection du profil{% endblock title %} {% block title %}Sélection du profil{% endblock title %}
{% block header %}
<h1>Sélection du profil</h1>
{% endblock header %}
{% block main %} {% block main %}
<h1>Sélection du profil</h1>
Vous êtes connecté, mais votre compte n'est associé à aucun profil. Veuillez contacter le webmestre à l'adresse <a href="mailto:valentin@mp2i-vms.fr">valentin@mp2i-vms.fr</a>. Vous êtes connecté, mais votre compte n'est associé à aucun profil. Veuillez contacter le webmestre à l'adresse <a href="mailto:valentin@mp2i-vms.fr">valentin@mp2i-vms.fr</a>.
{% endblock main %} {% endblock main %}

View File

@ -4,7 +4,6 @@
body { body {
font-family: sans-serif; font-family: sans-serif;
background-color: #fafafa;
margin: 0; margin: 0;
} }
@ -36,6 +35,49 @@ header .bandeau button:active {
background-color: darkgoldenrod; background-color: darkgoldenrod;
} }
.navbar {
background-color: #eee;
display: flex;
flex-direction: column;
}
.navbar .block {
display: flex;
flex-direction: column;
text-align: center;
}
@media screen and (min-width: 400px)
{
.navbar {
padding: 0 10px;
flex-direction: row;
justify-content: space-between;
}
.navbar .block {
flex-direction: row;
gap: 0 10px;
}
}
.navbar a:link, .navbar a:visited {
color: black;
text-decoration: none;
}
.navbar .link {
background: none;
border: none;
font: inherit;
padding: 10px;
cursor: pointer;
}
.navbar .link:hover {
background-color: #ddd;
}
main { main {
margin: 20px auto; margin: 20px auto;
width: clamp(350px, 60%, 1200px); width: clamp(350px, 60%, 1200px);
@ -47,6 +89,34 @@ h1 {
text-align: center; text-align: center;
} }
form.login table {
margin: auto;
}
form.login input[type=text], form.login input[type=password] {
padding: 5px;
border: none;
background-color: #eee;
}
form.login button {
border: none;
padding: 10px;
background-color: dodgerblue;
border-radius: 5px;
color: white;
display: block;
margin: 15px auto;
}
form.login button:hover {
background-color: #0483ff;
}
form.login button:active {
background-color: #0077ea;
}
nav.semaine { nav.semaine {
width: 100%; width: 100%;
display: flex; display: flex;

View File

@ -5,28 +5,73 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}{% endblock title %}</title> <title>{% block title %}{% endblock title %}</title>
<link href="{% static 'unified-navigator/navigator.css' %}" rel="stylesheet" type="text/css">
<link href="{% static 'main.css' %}" rel="stylesheet" type="text/css"> <link href="{% static 'main.css' %}" rel="stylesheet" type="text/css">
<script src="https://kit.fontawesome.com/0fd87250ec.js" crossorigin="anonymous"></script> <script src="https://kit.fontawesome.com/0fd87250ec.js" crossorigin="anonymous"></script>
{% block head %}{% endblock head %} {% block head %}{% endblock head %}
</head> </head>
<body> <body>
<header> <header>
<script>
function navigator_toggleMenu() {
if (document.body.clientWidth > 600)
return document.location = "https://mp2i-vms.fr"
if (document.getElementById("menu-sec").classList.contains("hidden")) {
document.getElementById("menu-sec").classList.remove("hidden");
document.getElementById("navigator-dropdown-indicator").className = "fa-solid fa-caret-up";
} else {
document.getElementById("menu-sec").classList.add("hidden");
document.getElementById("navigator-dropdown-indicator").className = "fa-solid fa-caret-down";
}
}
</script>
<div class="unified_navigator">
<div class="nav-container">
<div class="logo-wrapper" onclick="navigator_toggleMenu();">
<a class="logo">
<img src="{% static 'unified-navigator/icon.png' %}" alt="logo"><strong>mp2i-vms.fr</strong>
</a>
<i id="navigator-dropdown-indicator" class="fa-solid fa-caret-down"></i>
</div>
<div class="menu-wrapper hidden" id="menu-sec">
<div class="link"><a href="https://mp2i-vms.fr/pages.html"><i class="fa-solid fa-house"></i> Pages personnelles</a></div>
<div class="link"><a href="https://git.mp2i-vms.fr"><i class="fa-brands fa-git-alt"></i> Git</a></div>
<div class="link"><a href="https://play.mp2i-vms.fr"><i class="fa-solid fa-cubes"></i> Minecraft</a></div>
<div class="link"><a href="{% url "home" %}"><i class="fa-solid fa-book"></i> Colles</a></div>
</div>
</div>
</div>
<div class="navbar">
<div class="block">
{% if request.user.is_authenticated %} {% if request.user.is_authenticated %}
<div class="bandeau"> <a href="{% url "colloscope.dashboard" %}">
Vous êtes connecté avec le compte <b>{{ user.username }}</b>. <div class="link"><i class="fa-solid fa-rocket"></i> Tableau de bord</div>
{% if request.session.profile == "student" %} </a>
Profil actuel : étudiant. <a href="{% url "colloscope.table" %}">
{% elif request.session.profile == "colleur" %} <div class="link"><i class="fa-solid fa-calendar"></i> Colloscope</div>
Profil actuel : colleur. </a>
{% else %} <a href="{% url "colloscope.marketplace" %}">
Pas de profil. <div class="link"><i class="fa-solid fa-shop"></i> Marketplace</div>
</a>
{% endif %} {% endif %}
</div>
<div class="block">
{% if request.user.is_authenticated %}
<form action="{% url 'logout' %}" method="post"> <form action="{% url 'logout' %}" method="post">
{% csrf_token %} {% csrf_token %}
<button type="submit">Se déconnecter</button> <button class="link" type="submit" href="{% url "login" %}">
<i class="fa-solid fa-right-from-bracket"></i> Se déconnecter
</button>
</form> </form>
</div> {% else %}
<a href="{% url "login" %}">
<div class="link right"><i class="fa-solid fa-right-from-bracket"></i> Se connecter</div>
</a>
{% endif %} {% endif %}
</div>
</div>
{% block header %}{% endblock header %} {% block header %}{% endblock header %}
</header> </header>

View File

@ -19,7 +19,7 @@
{% endif %} {% endif %}
{% endif %} {% endif %}
<form method="post" action="{% url 'login' %}"> <form class="login" method="post" action="{% url 'login' %}">
{% csrf_token %} {% csrf_token %}
<table> <table>
<tr> <tr>
@ -31,8 +31,7 @@
<td>{{ form.password }}</td> <td>{{ form.password }}</td>
</tr> </tr>
</table> </table>
<button type="submit">Se connecter</button>
<input type="submit" value="Se connecter">
<input type="hidden" name="next" value="{{ next }}"> <input type="hidden" name="next" value="{{ next }}">
</form> </form>