plateforme-corres2math/templates/base.html

256 lines
13 KiB
HTML
Raw Normal View History

2020-09-20 20:31:37 +00:00
{% load static i18n static %}
<!DOCTYPE html>
2020-09-24 08:21:50 +00:00
{% 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">
2020-09-20 20:31:37 +00:00
<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 des Correspondances
</title>
<meta name="description" content="Plateform d'inscription aux Correspondances des Jeunes Mathématicien·nes.">
{# Favicon #}
<link rel="shortcut icon" href="{% static "favicon.ico" %}">
<meta name="theme-color" content="#ffffff">
{% if no_cache %}
<meta name="turbolinks-cache-control" content="no-cache">
{% endif %}
{# Bootstrap CSS #}
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"
crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.13.0/css/all.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.13.0/css/v4-shims.css">
{# JQuery, Bootstrap and Turbolinks JavaScript #}
<script src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha384-vk5WoKIaW/vJyUAd9n/wmopsmNhiy+L2Z+SBxGYnUkunIxVxAv/UtMOhba/xskxh"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"
integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/turbolinks/5.2.0/turbolinks.js"
crossorigin="anonymous"></script>
{# 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">
<main class="mb-auto">
<nav class="navbar navbar-expand-md navbar-light bg-light fixed-navbar shadow-sm">
<a class="navbar-brand" href="https://correspondances-maths.fr/">
<img src="{% static "logo.png" %}" style="width: 42px;" alt="Logo Correspondances" id="navbar-logo">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse"
data-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">
2020-09-24 08:21:50 +00:00
<ul class="navbar-nav">
2020-09-20 20:31:37 +00:00
<li class="nav-item active">
<a href="{% url "index" %}" class="nav-link"><i class="fas fa-home"></i> {% trans "Home" %}</a>
</li>
2020-09-24 08:21:50 +00:00
{% if user.is_authenticated and user.registration.participates %}
{% if not user.registration.team %}
<li class="nav-item active">
<a href="#" class="nav-link" data-toggle="modal" data-target="#createTeamModal">
<i class="fas fa-users"></i> {% trans "Create team" %}
</a>
</li>
<li class="nav-item active">
<a href="#" class="nav-link" data-toggle="modal" data-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>
2020-09-27 12:32:05 +00:00
<li class="nav-item active">
<a href="{% url "participation:my_participation_detail" %}" class="nav-link">
<i class="fas fa-video"></i> {% trans "My participation" %}
</a>
</li>
2020-09-24 08:21:50 +00:00
{% endif %}
2020-09-22 18:41:42 +00:00
{% endif %}
2020-09-20 20:31:37 +00:00
<li class="nav-item active">
<a class="nav-link" href="https://www.helloasso.com/associations/animath/formulaires/5/widget"><i
class="fas fa-hand-holding-heart"></i> {% trans "Make a gift" %}</a>
</li>
{% if user.admin %}
<li class="nav-item active">
<a data-turbolinks="false" class="nav-link" href="{% url "admin:index" %}"><i class="fas fa-cog"></i> {% trans "Administration" %}</a>
</li>
{% endif %}
</ul>
2020-09-24 08:21:50 +00:00
<ul class="navbar-nav ml-auto">
{% if user.registration.is_admin %}
2020-10-15 14:03:08 +00:00
<form class="navbar-form" role="search" onsubmit="event.preventDefault()">
<div class="input-group">
2020-10-15 14:03:08 +00:00
<input type="text" class="form-control" placeholder="{% trans "Search..." %}" name="q" id="search-term" value="{{ request.GET.q }}">
<div class="input-group-btn">
2020-10-15 14:03:08 +00:00
<button class="btn btn-default" data-toggle="modal" data-target="#searchModal"><i class="fa fa-search"></i></button>
</div>
</div>
</form>
{% endif %}
2020-09-20 20:31:37 +00:00
{% if "_fake_user_id" in request.session %}
<li class="nav-item active">
2020-10-19 14:08:42 +00:00
<a class="nav-link" href="{% url "registration:reset_admin" %}?path={{ request.path }}"><i class="fas fa-tools"></i> {% trans "Return to admin view" %}</a>
2020-09-20 20:31:37 +00:00
</li>
{% endif %}
{% if not user.is_authenticated %}
2020-09-22 10:27:03 +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-09-20 20:31:37 +00:00
<li class="nav-item active">
2020-09-22 18:58:18 +00:00
<a class="nav-link" href="#" data-toggle="modal" data-target="#loginModal">
<i class="fas fa-sign-in-alt"></i> {% trans "Log in" %}
</a>
2020-09-20 20:31:37 +00:00
</li>
{% else %}
2020-09-24 08:21:50 +00:00
<li class="dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-user"></i> {{ user.first_name }} {{ user.last_name }}
</a>
<div class="dropdown-menu dropdown-menu-right"
aria-labelledby="navbarDropdownMenuLink">
2020-09-24 16:39:55 +00:00
<a class="dropdown-item" href="{% url "registration:my_account_detail" %}">
<i class="fas fa-user"></i> {% trans "My account" %}
</a>
2020-09-24 08:21:50 +00:00
<a class="dropdown-item" href="{% url "logout" %}">
<i class="fas fa-sign-out-alt"></i> {% trans "Log out" %}
</a>
</div>
2020-09-20 20:31:37 +00:00
</li>
{% endif %}
</ul>
</div>
</nav>
2020-09-24 08:21:50 +00:00
<div class="{% block containertype %}container{% endblock %} my-3">
{% block contenttitle %}{% endblock %}
{% if user.is_authenticated and not user.registration.email_confirmed %}
<div class="alert alert-warning alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</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 %}
2020-09-20 20:31:37 +00:00
<div id="messages"></div>
2020-09-22 19:20:20 +00:00
<div id="content">
{% block content %}
<p>Default content...</p>
{% endblock content %}
</div>
2020-09-20 20:31:37 +00:00
</div>
</main>
2020-09-24 08:21:50 +00:00
<footer class="bg-light text-primary mt-auto py-2">
2020-09-20 20:31:37 +00:00
<div class="container-fluid">
<div class="row">
2020-09-24 08:21:50 +00:00
<div class="col-10">
2020-09-20 20:31:37 +00:00
<form action="{% url 'set_language' %}" method="post"
class="form-inline">
<span class="text-muted mr-1">
2020-09-24 16:39:55 +00:00
<a target="_blank" href="mailto:&#99;&#111;&#110;&#116;&#97;&#99;&#116;&#64;&#99;&#111;&#114;&#114;&#101;&#115;&#112;&#111;&#110;&#100;&#97;&#110;&#99;&#101;&#115;&#45;&#109;&#97;&#116;&#104;&#115;&#46;&#102;&#114;"
2020-09-20 20:31:37 +00:00
class="text-muted">{% trans "Contact us" %}</a> &mdash;
</span>
{% csrf_token %}
<select title="language" name="language"
2020-09-24 08:21:50 +00:00
class="form-control form-control-sm language"
2020-09-20 20:31:37 +00:00
onchange="this.form.submit()">
{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as LANGUAGES %}
2020-09-24 08:21:50 +00:00
{% for lang_code, lang_name in LANGUAGES %}
<option value="{{ lang_code }}"
{% if lang_code == LANGUAGE_CODE %}
2020-09-20 20:31:37 +00:00
selected{% endif %}>
2020-09-24 08:21:50 +00:00
{{ lang_name }} ({{ lang_code }})
2020-09-20 20:31:37 +00:00
</option>
{% endfor %}
</select>
<noscript>
<input type="submit">
</noscript>
</form>
</div>
2020-09-24 08:21:50 +00:00
<div class="col text-right">
<a href="#" data-turbolinks="false" class="text-muted">
<i class="fa fa-arrow-up" aria-hidden="true"></i>
</a>
2020-09-20 20:31:37 +00:00
</div>
</div>
</div>
</footer>
2020-10-15 14:03:08 +00:00
{% trans "Search results" as modal_title %}
{% include "base_modal.html" with modal_id="search" modal_form_method="get" modal_additional_class="modal-lg" %}
2020-09-24 19:43:45 +00:00
{% 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" %}
2020-09-22 18:41:42 +00:00
{% if user.is_authenticated %}
2020-09-24 19:43:45 +00:00
{% 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" %}
2020-09-22 18:41:42 +00:00
{% endif %}
2020-09-20 20:31:37 +00:00
<script>
CSRF_TOKEN = "{{ csrf_token }}";
2020-09-24 08:21:50 +00:00
$(".invalid-feedback").addClass("d-block");
2020-09-22 18:41:42 +00:00
$(document).ready(function () {
2020-10-15 14:03:08 +00:00
$('button[data-target="#searchModal"]').click(function() {
let modalBody = $("#searchModal div.modal-body");
2020-10-15 14:49:34 +00:00
let q = encodeURI($("#search-term").val());
2020-10-15 14:03:08 +00:00
modalBody.load("{% url "haystack_search" %}?q=" + q + " #search-results");
});
2020-09-22 18:58:18 +00:00
$('a[data-target="#loginModal"]').click(function() {
let modalBody = $("#loginModal div.modal-body");
if (!modalBody.html().trim())
modalBody.load("{% url "login" %} #form-content")
});
2020-09-22 18:41:42 +00:00
$('a[data-target="#createTeamModal"]').click(function() {
let modalBody = $("#createTeamModal div.modal-body");
if (!modalBody.html().trim())
modalBody.load("{% url "participation:create_team" %} #form-content");
});
$('a[data-target="#joinTeamModal"]').click(function() {
let modalBody = $("#joinTeamModal div.modal-body");
if (!modalBody.html().trim())
modalBody.load("{% url "participation:join_team" %} #form-content");
});
});
2020-09-20 20:31:37 +00:00
</script>
2020-09-24 08:21:50 +00:00
{% block extrajavascript %}{% endblock %}
2020-09-20 20:31:37 +00:00
</body>
</html>