Rearrange base template with separated contents, add sidebar

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello 2024-02-11 18:43:23 +01:00
parent 21ff044044
commit 2b941cb30f
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
9 changed files with 224 additions and 204 deletions

View File

@ -2,7 +2,7 @@
{% load django_tables2 i18n %}
{% block contenttitle %}
{% block content-title %}
<h1>{% trans "All teams" %}</h1>
{% endblock %}

View File

@ -2,7 +2,7 @@
{% load django_tables2 i18n %}
{% block contenttitle %}
{% block content-title %}
<h1>{% trans "All tournaments" %}</h1>
{% endblock %}

View File

@ -1,6 +1,6 @@
{% extends "base.html" %}
{% block contenttitle %}
{% block content-title %}
<h1>À propos</h1>
{% endblock %}

View File

@ -1,15 +1,15 @@
{% load static i18n static %}
{% load i18n static %}
<!DOCTYPE html>
{% get_current_language as LANGUAGE_CODE %}{% get_current_language_bidi as LANGUAGE_BIDI %}
<html lang="{{ LANGUAGE_CODE|default:"en" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif %} class="position-relative h-100">
<html lang="{{ LANGUAGE_CODE|default:"fr" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif %} class="position-relative h-100">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>
{% block title %}{{ title }}{% endblock title %} - Plateforme du TFJM²
</title>
<meta name="description" content="Plateform d'inscription au TFJM².">
<meta name="description" content="Plateforme d'inscription au TFJM².">
{# Favicon #}
<link rel="shortcut icon" href="{% static "favicon.ico" %}">
@ -25,7 +25,7 @@
{# Bootstrap JavaScript #}
<script src="{% static 'bootstrap/js/bootstrap.bundle.min.js' %}"></script>
{# bootstrap-select for beautyful selects and JQuery dependency #}
{# bootstrap-select for beautiful selects and JQuery dependency #}
<script src="{% static 'jquery/jquery.min.js' %}"></script>
<script src="{% static 'bootstrap-select/js/bootstrap-select.min.js' %}"></script>
<script src="{% static 'bootstrap-select/js/defaults-fr_FR.min.js' %}"></script>
@ -38,206 +38,31 @@
{% block extracss %}{% endblock %}
</head>
<body class="d-flex w-100 h-100 flex-column">
<nav class="navbar navbar-expand-lg fixed-navbar shadow-sm">
<div class="container-fluid">
<a class="navbar-brand" href="https://tfjm.org/">
<img src="{% static "tfjm.svg" %}" style="height: 2em;" alt="Logo TFJM²" id="navbar-logo">
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarNavDropdown"
aria-controls="navbarNavDropdown" aria-expanded="false"
aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div id="navbarNavDropdown" class="collapse navbar-collapse">
<ul class="navbar-nav">
<li class="nav-item active">
<a href="{% url "index" %}" class="nav-link"><i class="fas fa-home"></i> {% trans "Home" %}</a>
</li>
<li class="nav-item active">
<a href="#" class="nav-link" data-bs-toggle="modal" data-bs-target="#tournamentListModal">
<i class="fas fa-calendar-day"></i> {% trans "Tournaments" %}
</a>
</li>
{% if user.is_authenticated and user.registration.is_volunteer %}
<li class="nav-item active">
<a href="{% url "registration:user_list" %}" class="nav-link"><i class="fas fa-user"></i> {% trans "Users" %}</a>
</li>
<li class="nav-item active">
<a href="#" class="nav-link" data-bs-toggle="modal" data-bs-target="#teamsModal"><i class="fas fa-users"></i> {% trans "Teams" %}</a>
</li>
{% elif user.is_authenticated and user.registration.participates %}
{% if not user.registration.team %}
<li class="nav-item active">
<a href="#" class="nav-link" data-bs-toggle="modal" data-bs-target="#createTeamModal">
<i class="fas fa-users"></i> {% trans "Create team" %}
</a>
</li>
<li class="nav-item active">
<a href="#" class="nav-link" data-bs-toggle="modal" data-bs-target="#joinTeamModal">
<i class="fas fa-users"></i> {% trans "Join team" %}
</a>
</li>
{% else %}
<li class="nav-item active">
<a href="{% url "participation:my_team_detail" %}" class="nav-link">
<i class="fas fa-users"></i> {% trans "My team" %}
</a>
</li>
<li class="nav-item active">
<a href="{% url "participation:my_participation_detail" %}" class="nav-link">
<i class="fas fa-file-pdf"></i> {% trans "My participation" %}
</a>
</li>
{% endif %}
{% endif %}
{% if user.is_authenticated %}
{% if user.registration.is_volunteer or user.registration.team %}
<li class="nav-item active">
<a class="nav-link" href="{% url 'draw:index' %}">
<i class="fas fa-archive"></i> {% trans "Draw" %}
</a>
</li>
{% endif %}
{% endif %}
<li class="nav-item active d-none">
<a class="nav-link" href="{% url "participation:chat" %}">
<i class="fas fa-comments"></i> {% trans "Chat" %}
</a>
</li>
{% if user.registration.is_admin %}
<li class="nav-item active">
<a class="nav-link" href="{% url "admin:index" %}"><i class="fas fa-cog"></i> {% trans "Administration" %}</a>
</li>
{% endif %}
</ul>
<ul class="navbar-nav ms-auto">
{% if user.registration.is_admin %}
<form class="navbar-form d-flex" role="search" onsubmit="event.preventDefault()">
<div class="input-group">
<input type="text" class="form-control" placeholder="{% trans "Search" %}" name="q" id="search-term" value="{{ request.GET.q }}">
<div class="input-group-btn">
<button class="btn btn-default" data-bs-toggle="modal" data-bs-target="#searchModal"><i class="fa fa-search text-body"></i></button>
</div>
</div>
</form>
{% endif %}
{% if "_fake_user_id" in request.session %}
<li class="nav-item active">
<a class="nav-link" href="{% url "registration:reset_admin" %}?path={{ request.path }}"><i class="fas fa-tools"></i> {% trans "Return to admin view" %}</a>
</li>
{% endif %}
{% if not user.is_authenticated %}
<li class="nav-item active">
<a class="nav-link" href="{% url "registration:signup" %}"><i class="fas fa-user-plus"></i> {% trans "Register" %}</a>
</li>
<li class="nav-item active">
<a class="nav-link" href="#" data-bs-toggle="modal" data-bs-target="#loginModal">
<i class="fas fa-sign-in-alt"></i> {% trans "Log in" %}
</a>
</li>
{% else %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink"
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-user"></i> {{ user.first_name }} {{ user.last_name }}
</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownMenuLink">
<li>
<a class="dropdown-item" href="{% url "registration:my_account_detail" %}">
<i class="fas fa-user"></i> {% trans "My account" %}
</a>
</li>
<li>
<a class="dropdown-item" href="{% url "logout" %}">
<i class="fas fa-sign-out-alt"></i> {% trans "Log out" %}
</a>
</li>
</ul>
</li>
{% endif %}
</ul>
</div>
</div>
</nav>
<main class="mb-auto flex-shrink-0">
{% block fullcontent %}
<div class="{% block containertype %}container{% endblock %} my-3">
{% block contenttitle %}<h1>{{ title }}</h1>{% endblock %}
{% if user.is_authenticated and not user.registration.email_confirmed %}
<div class="alert alert-warning alert-dismissible" role="alert">
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
{% url "registration:email_validation_resend" pk=user.pk as send_email_url %}
{% blocktrans trimmed %}
Your email address is not validated. Please click on the link you received by email.
You can resend a mail by clicking on <a href="{{ send_email_url }}">this link</a>.
{% endblocktrans %}
</div>
{% endif %}
<div id="messages">
{% for message in messages %}
<div class="alert alert-{{ message.tags }} alert-dismissible fade show" role="alert">
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
{{ message | safe }}
</div>
{% endfor %}
</div>
<div id="content">
{% block content %}
<p>Default content...</p>
{% endblock content %}
</div>
</div>
{% endblock %}
</main>
{% include "navbar.html" %}
<footer class="text-primary mt-auto py-2">
<div class="container-fluid">
<div class="row">
<div class="col-sm-1">
<span class="text-muted mr-1">
<a target="_blank" href="mailto:&#99;&#111;&#110;&#116;&#97;&#99;&#116;&#64;&#116;&#102;&#106;&#109;&#46;&#111;&#114;&#103;"
class="text-muted"><i class="fas fa-envelope"></i> {% trans "Contact us" %}</a>
</span>
</div>
<div class="col-sm-1">
<form action="{% url 'set_language' %}" method="post"
class="form-inline">
{% csrf_token %}
<select title="language" name="language"
class="form-control form-control-sm language"
onchange="this.form.submit()">
{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as LANGUAGES %}
{% for lang_code, lang_name in LANGUAGES %}
<option value="{{ lang_code }}"
{% if lang_code == LANGUAGE_CODE %}
selected{% endif %}>
{{ lang_name }} ({{ lang_code }})
</option>
{% endfor %}
</select> &nbsp;
<noscript>
<input type="submit">
</noscript>
</form>
</div>
<div class="col-sm-9">
<div id="body-wrapper" class="row w-100 my-3">
<aside class="col-lg-2 px-2">
{% include "sidebar.html" %}
</aside>
<a target="_blank" class="text-muted" href="{% url "about" %}">{% trans "About" %}</a> &nbsp; &mdash; &nbsp;
<a target="_blank" class="text-muted"
href="https://gitlab.com/animath/si/plateforme-tfjm">
<i class="fab fa-gitlab"></i>
</a>
</div>
<div class="col-sm-1 text-end">
<a href="#" class="text-muted">
<i class="fa fa-arrow-up" aria-hidden="true"></i>
</a>
<main class="col d-flex flex-column">
<div class="container">
{% block content-title %}<h1 id="content-title">{{ title }}</h1>{% endblock %}
{% include "messages.html" %}
<div id="content">
{% block content %}
<p>Default content...</p>
{% endblock content %}
</div>
</div>
</div>
</footer>
</main>
<aside class="col-lg-2"></aside>
</div>
{% include "footer.html" %}
{% trans "All tournaments" as modal_title %}
{% include "base_modal.html" with modal_id="tournamentList" modal_additional_class="modal-lg" %}

View File

@ -0,0 +1,50 @@
{% load i18n static %}
{% get_current_language as LANGUAGE_CODE %}{% get_current_language_bidi as LANGUAGE_BIDI %}
<footer class="text-primary mt-lg-auto">
<div class="container-fluid">
<div class="row">
<div class="col-sm-1">
<span class="text-muted mr-1">
<a target="_blank" href="mailto:&#99;&#111;&#110;&#116;&#97;&#99;&#116;&#64;&#116;&#102;&#106;&#109;&#46;&#111;&#114;&#103;"
class="text-muted"><i class="fas fa-envelope"></i> {% trans "Contact us" %}</a>
</span>
</div>
<div class="col-sm-1">
<form action="{% url 'set_language' %}" method="post"
class="form-inline">
{% csrf_token %}
<select title="language" name="language"
class="form-control form-control-sm language"
onchange="this.form.submit()">
{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as LANGUAGES %}
{% for lang_code, lang_name in LANGUAGES %}
<option value="{{ lang_code }}"
{% if lang_code == LANGUAGE_CODE %}
selected{% endif %}>
{{ lang_name }} ({{ lang_code }})
</option>
{% endfor %}
</select> &nbsp;
<noscript>
<input type="submit">
</noscript>
</form>
</div>
<div class="col-sm-9">
<a target="_blank" class="text-muted" href="{% url "about" %}">{% trans "About" %}</a> &nbsp; &mdash; &nbsp;
<a target="_blank" class="text-muted"
href="https://gitlab.com/animath/si/plateforme-tfjm">
<i class="fab fa-gitlab"></i>
</a>
</div>
<div class="col-sm-1 text-end">
<a href="#" class="text-muted">
<i class="fa fa-arrow-up" aria-hidden="true"></i>
</a>
</div>
</div>
</div>
</footer>

View File

@ -0,0 +1,8 @@
<div id="messages">
{% for message in messages %}
<div class="alert alert-{{ message.tags }} alert-dismissible fade show" role="alert">
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
{{ message | safe }}
</div>
{% endfor %}
</div>

124
tfjm/templates/navbar.html Normal file
View File

@ -0,0 +1,124 @@
{% load i18n static %}
<nav class="navbar navbar-expand-lg fixed-navbar shadow-sm">
<div class="container-fluid">
<a class="navbar-brand" href="https://tfjm.org/">
<img src="{% static "tfjm.svg" %}" style="height: 2em;" alt="Logo TFJM²" id="navbar-logo">
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarNavDropdown"
aria-controls="navbarNavDropdown" aria-expanded="false"
aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div id="navbarNavDropdown" class="collapse navbar-collapse">
<ul class="navbar-nav">
<li class="nav-item active">
<a href="{% url "index" %}" class="nav-link"><i class="fas fa-home"></i> {% trans "Home" %}</a>
</li>
<li class="nav-item active">
<a href="#" class="nav-link" data-bs-toggle="modal" data-bs-target="#tournamentListModal">
<i class="fas fa-calendar-day"></i> {% trans "Tournaments" %}
</a>
</li>
{% if user.is_authenticated and user.registration.is_volunteer %}
<li class="nav-item active">
<a href="{% url "registration:user_list" %}" class="nav-link"><i class="fas fa-user"></i> {% trans "Users" %}</a>
</li>
<li class="nav-item active">
<a href="#" class="nav-link" data-bs-toggle="modal" data-bs-target="#teamsModal"><i class="fas fa-users"></i> {% trans "Teams" %}</a>
</li>
{% elif user.is_authenticated and user.registration.participates %}
{% if not user.registration.team %}
<li class="nav-item active">
<a href="#" class="nav-link" data-bs-toggle="modal" data-bs-target="#createTeamModal">
<i class="fas fa-users"></i> {% trans "Create team" %}
</a>
</li>
<li class="nav-item active">
<a href="#" class="nav-link" data-bs-toggle="modal" data-bs-target="#joinTeamModal">
<i class="fas fa-users"></i> {% trans "Join team" %}
</a>
</li>
{% else %}
<li class="nav-item active">
<a href="{% url "participation:my_team_detail" %}" class="nav-link">
<i class="fas fa-users"></i> {% trans "My team" %}
</a>
</li>
<li class="nav-item active">
<a href="{% url "participation:my_participation_detail" %}" class="nav-link">
<i class="fas fa-file-pdf"></i> {% trans "My participation" %}
</a>
</li>
{% endif %}
{% endif %}
{% if user.is_authenticated %}
{% if user.registration.is_volunteer or user.registration.team %}
<li class="nav-item active">
<a class="nav-link" href="{% url 'draw:index' %}">
<i class="fas fa-archive"></i> {% trans "Draw" %}
</a>
</li>
{% endif %}
{% endif %}
<li class="nav-item active d-none">
<a class="nav-link" href="{% url "participation:chat" %}">
<i class="fas fa-comments"></i> {% trans "Chat" %}
</a>
</li>
{% if user.registration.is_admin %}
<li class="nav-item active">
<a class="nav-link" href="{% url "admin:index" %}"><i class="fas fa-cog"></i> {% trans "Administration" %}</a>
</li>
{% endif %}
</ul>
<ul class="navbar-nav ms-auto">
{% if user.registration.is_admin %}
<form class="navbar-form d-flex" role="search" onsubmit="event.preventDefault()">
<div class="input-group">
<input type="text" class="form-control" placeholder="{% trans "Search" %}" name="q" id="search-term" value="{{ request.GET.q }}">
<div class="input-group-btn">
<button class="btn btn-default" data-bs-toggle="modal" data-bs-target="#searchModal"><i class="fa fa-search text-body"></i></button>
</div>
</div>
</form>
{% endif %}
{% if "_fake_user_id" in request.session %}
<li class="nav-item active">
<a class="nav-link" href="{% url "registration:reset_admin" %}?path={{ request.path }}"><i class="fas fa-tools"></i> {% trans "Return to admin view" %}</a>
</li>
{% endif %}
{% if not user.is_authenticated %}
<li class="nav-item active">
<a class="nav-link" href="{% url "registration:signup" %}"><i class="fas fa-user-plus"></i> {% trans "Register" %}</a>
</li>
<li class="nav-item active">
<a class="nav-link" href="#" data-bs-toggle="modal" data-bs-target="#loginModal">
<i class="fas fa-sign-in-alt"></i> {% trans "Log in" %}
</a>
</li>
{% else %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink"
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-user"></i> {{ user.first_name }} {{ user.last_name }}
</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownMenuLink">
<li>
<a class="dropdown-item" href="{% url "registration:my_account_detail" %}">
<i class="fas fa-user"></i> {% trans "My account" %}
</a>
</li>
<li>
<a class="dropdown-item" href="{% url "logout" %}">
<i class="fas fa-sign-out-alt"></i> {% trans "Log out" %}
</a>
</li>
</ul>
</li>
{% endif %}
</ul>
</div>
</div>
</nav>

View File

@ -5,7 +5,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
{% load i18n crispy_forms_filters %}
{% block title %}{% trans "Log in" %}{% endblock %}
{% block contenttitle %}<h1>{% trans "Log in" %}</h1>{% endblock %}
{% block content-title %}<h1>{% trans "Log in" %}</h1>{% endblock %}
{% block content %}
{% if user.is_authenticated %}

View File

@ -0,0 +1,13 @@
{% load i18n %}
<div>
{% if user.is_authenticated and not user.registration.email_confirmed %}
<div class="alert alert-warning" role="alert">
{% url "registration:email_validation_resend" pk=user.pk as send_email_url %}
{% blocktrans trimmed %}
Your email address is not validated. Please click on the link you received by email.
You can resend a mail by clicking on <a href="{{ send_email_url }}">this link</a>.
{% endblocktrans %}
</div>
{% endif %}
</div>