1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2024-12-27 12:22:21 +00:00
plateforme-tfjm2/tfjm/templates/base.html

282 lines
14 KiB
HTML
Raw Normal View History

2020-12-28 17:52:50 +00:00
{% load static i18n static %}
2020-12-27 10:49:54 +00:00
<!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">
<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².">
{# Favicon #}
<link rel="shortcut icon" href="{% static "favicon.ico" %}">
<meta name="theme-color" content="#ffffff">
{# Bootstrap CSS #}
2021-04-12 20:41:50 +00:00
<link rel="stylesheet" href="{% static 'bootstrap/css/bootstrap.min.css' %}">
<link rel="stylesheet" href="{% static 'fontawasome/css/all.css' %}">
<link rel="stylesheet" href="{% static 'fontawasome/css/v4-shims.css' %}">
2020-12-27 10:49:54 +00:00
<link rel="stylesheet" href="{% static 'bootstrap-select/css/bootstrap-select.min.css' %}">
{# Bootstrap JavaScript #}
2021-04-12 20:41:50 +00:00
<script src="{% static 'bootstrap/js/bootstrap.bundle.min.js' %}"></script>
2020-12-27 10:49:54 +00:00
{# bootstrap-select for beautyful 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>
2020-12-27 10:49:54 +00:00
{# Si un formulaire requiert des données supplémentaires (notamment JS), les données sont chargées #}
{% if form.media %}
{{ form.media }}
{% endif %}
{% block extracss %}{% endblock %}
</head>
<body class="d-flex w-100 h-100 flex-column">
<nav class="navbar navbar-expand-lg fixed-navbar shadow-sm">
2023-02-20 13:52:25 +00:00
<div class="container-fluid">
2020-12-27 10:49:54 +00:00
<a class="navbar-brand" href="https://tfjm.org/">
<img src="{% static "tfjm.svg" %}" style="height: 2em;" alt="Logo TFJM²" id="navbar-logo">
2020-12-27 10:49:54 +00:00
</a>
2023-02-20 13:52:25 +00:00
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarNavDropdown"
2020-12-27 10:49:54 +00:00
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>
2020-12-30 11:13:05 +00:00
<li class="nav-item active">
2023-02-20 13:52:25 +00:00
<a href="#" class="nav-link" data-bs-toggle="modal" data-bs-target="#tournamentListModal">
2020-12-30 11:13:05 +00:00
<i class="fas fa-calendar-day"></i> {% trans "Tournaments" %}
</a>
</li>
2021-02-06 18:26:19 +00:00
{% if user.is_authenticated and user.registration.is_volunteer %}
2020-12-27 10:49:54 +00:00
<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">
2023-02-20 13:52:25 +00:00
<a href="#" class="nav-link" data-bs-toggle="modal" data-bs-target="#teamsModal"><i class="fas fa-users"></i> {% trans "Teams" %}</a>
2020-12-27 10:49:54 +00:00
</li>
{% elif user.is_authenticated and user.registration.participates %}
{% if not user.registration.team %}
<li class="nav-item active">
2023-02-20 13:52:25 +00:00
<a href="#" class="nav-link" data-bs-toggle="modal" data-bs-target="#createTeamModal">
2020-12-27 10:49:54 +00:00
<i class="fas fa-users"></i> {% trans "Create team" %}
</a>
</li>
<li class="nav-item active">
2023-02-20 13:52:25 +00:00
<a href="#" class="nav-link" data-bs-toggle="modal" data-bs-target="#joinTeamModal">
2020-12-27 10:49:54 +00:00
<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">
2021-01-12 14:42:32 +00:00
<i class="fas fa-file-pdf"></i> {% trans "My participation" %}
2020-12-27 10:49:54 +00:00
</a>
</li>
{% endif %}
{% endif %}
<li class="nav-item active">
<a class="nav-link" href="{% url "participation:chat" %}">
<i class="fas fa-comments"></i> {% trans "Chat" %}</a>
</li>
2023-03-29 16:33:48 +00:00
{% if user.registration.is_admin %}
2020-12-27 10:49:54 +00:00
<li class="nav-item active">
2023-02-20 12:42:36 +00:00
<a class="nav-link" href="{% url "admin:index" %}"><i class="fas fa-cog"></i> {% trans "Administration" %}</a>
2020-12-27 10:49:54 +00:00
</li>
{% endif %}
</ul>
2023-02-20 13:52:25 +00:00
<ul class="navbar-nav ms-auto">
2020-12-27 10:49:54 +00:00
{% if user.registration.is_admin %}
2023-02-20 13:52:25 +00:00
<form class="navbar-form d-flex" role="search" onsubmit="event.preventDefault()">
2020-12-27 10:49:54 +00:00
<div class="input-group">
2023-02-20 13:52:25 +00:00
<input type="text" class="form-control" placeholder="{% trans "Search" %}" name="q" id="search-term" value="{{ request.GET.q }}">
2020-12-27 10:49:54 +00:00
<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>
2020-12-27 10:49:54 +00:00
</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 %}
2020-12-28 17:52:50 +00:00
<li class="nav-item active">
<a class="nav-link" href="{% url "registration:signup" %}"><i class="fas fa-user-plus"></i> {% trans "Register" %}</a>
</li>
2020-12-27 10:49:54 +00:00
<li class="nav-item active">
2023-02-20 13:52:25 +00:00
<a class="nav-link" href="#" data-bs-toggle="modal" data-bs-target="#loginModal">
2020-12-27 10:49:54 +00:00
<i class="fas fa-sign-in-alt"></i> {% trans "Log in" %}
</a>
</li>
{% else %}
2023-02-20 13:52:25 +00:00
<li class="nav-item dropdown">
2020-12-27 10:49:54 +00:00
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink"
2023-02-20 13:52:25 +00:00
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
2020-12-27 10:49:54 +00:00
<i class="fas fa-user"></i> {{ user.first_name }} {{ user.last_name }}
</a>
2023-02-20 13:52:25 +00:00
<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>
2020-12-27 10:49:54 +00:00
</li>
{% endif %}
</ul>
</div>
2023-02-20 13:52:25 +00:00
</div>
2020-12-27 10:49:54 +00:00
</nav>
2023-02-20 13:52:25 +00:00
<main class="mb-auto flex-shrink-0">
2020-12-27 10:49:54 +00:00
{% block fullcontent %}
<div class="{% block containertype %}container{% endblock %} my-3">
{% block contenttitle %}{% endblock %}
{% if user.is_authenticated and not user.registration.email_confirmed %}
2023-02-20 13:52:25 +00:00
<div class="alert alert-warning alert-dismissible" role="alert">
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
2020-12-27 10:49:54 +00:00
{% 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"></div>
2020-12-27 10:49:54 +00:00
<div id="content">
{% block content %}
<p>Default content...</p>
{% endblock content %}
</div>
</div>
{% endblock %}
</main>
<footer class="text-primary mt-auto py-2">
2020-12-27 10:49:54 +00:00
<div class="container-fluid">
<div class="row">
2023-02-20 13:52:25 +00:00
<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">
2020-12-27 10:49:54 +00:00
<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">
2023-02-20 13:52:25 +00:00
</noscript>
</form>
</div>
<div class="col-sm-9">
2020-12-27 10:49:54 +00:00
<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>
2023-02-20 13:52:25 +00:00
<div class="col-sm-1 text-end">
2023-02-20 12:42:36 +00:00
<a href="#" class="text-muted">
2020-12-27 10:49:54 +00:00
<i class="fa fa-arrow-up" aria-hidden="true"></i>
</a>
</div>
</div>
</div>
</footer>
2020-12-30 11:13:05 +00:00
{% trans "All tournaments" as modal_title %}
{% include "base_modal.html" with modal_id="tournamentList" modal_additional_class="modal-lg" %}
2020-12-27 10:49:54 +00:00
{% if user.is_authenticated %}
{% trans "All teams" as modal_title %}
{% include "base_modal.html" with modal_id="teams" modal_additional_class="modal-lg" %}
{% trans "Search results" as modal_title %}
{% include "base_modal.html" with modal_id="search" modal_form_method="get" modal_additional_class="modal-lg" %}
{% trans "Join team" as modal_title %}
{% trans "Join" as modal_button %}
{% url "participation:join_team" as modal_action %}
{% include "base_modal.html" with modal_id="joinTeam" %}
{% trans "Create team" as modal_title %}
{% trans "Create" as modal_button %}
{% url "participation:create_team" as modal_action %}
{% include "base_modal.html" with modal_id="createTeam" modal_button_type="success" %}
{% else %}
{% trans "Log in" as modal_title %}
{% trans "Log in" as modal_button %}
{% url "login" as modal_action %}
{% include "base_modal.html" with modal_id="login" %}
{% endif %}
<script src="{% static 'main.js' %}"></script>
<script src="{% static 'theme.js' %}"></script>
2020-12-27 10:49:54 +00:00
<script>
CSRF_TOKEN = "{{ csrf_token }}";
document.querySelectorAll(".invalid-feedback").forEach(elem => elem.classList.add('d-block'))
document.addEventListener('DOMContentLoaded', () => {
initModal("tournamentList", "{% url "participation:tournament_list" %}")
2020-12-30 11:13:05 +00:00
2020-12-27 10:49:54 +00:00
{% if user.is_authenticated and user.registration.is_admin %}
initModal("teams", "{% url "participation:team_list" %}")
initModal("search",
() => "{% url "haystack_search" %}?q=" + encodeURI(document.getElementById("search-term").value),
"search-results")
2020-12-27 10:49:54 +00:00
{% endif %}
{% if not user.is_authenticated %}
initModal("login", "{% url 'login' %}")
2020-12-27 10:49:54 +00:00
{% endif %}
{% if user.is_authenticated and user.registration.participates and not user.registration.team %}
initModal("createTeam", "{% url 'participation:create_team' %}")
initModal("joinTeam", "{% url 'participation:join_team' %}")
2020-12-27 10:49:54 +00:00
{% endif %}
})
2020-12-27 10:49:54 +00:00
</script>
{% block extrajavascript %}{% endblock %}
</body>
</html>