ScoDoc/app/templates/base.j2

92 lines
3.8 KiB
Django/Jinja

{# base des pages hors départements (accueil, configuration, ...) #}
{% extends 'babase.j2' %}
{% block styles %}
{{super()}}
<link rel="stylesheet" href="{{ scu.STATIC_DIR }}/css/scodoc.css">
<link rel="stylesheet" href="{{ scu.STATIC_DIR }}/css/entreprises.css">
{% endblock %}
{% block title %}
{% if title %}{{ title }} - ScoDoc{% else %}ScoDoc{% endif %}
{% endblock %}
{% block navbar %}
<nav class="navbar navbar-expand-md bg-light">
<div class="container container-fluid">
<a class="navbar-brand me-auto d-flex" href="{{ url_for('scodoc.index') }}">ScoDoc</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#index-nav" aria-controls="index-nav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
{# NAVBAR CONTENT #}
<div class="collapse navbar-collapse justify-content-center align-items-center" id="index-nav">
<ul class="navbar-nav justify-content-center">
{% if current_user.is_administrator() %}
<li class="nav-item"><a class="nav-link" href="{{ url_for('scodoc.configuration') }}">Configuration</a></li>
{% endif %}
{% if g.scodoc_dept %}
<li class="nav-item"><a class="nav-link" href="{{
url_for('scolar.index_html', scodoc_dept=g.scodoc_dept)
}}">Dept. {{ g.scodoc_dept }}</a></li>
{% endif %}
{% if not current_user.is_anonymous %}
<li class="nav-item">
<a class="nav-link" href="{{
url_for('scodoc.user_board', user_name=current_user.user_name)
}}">Tableau de bord</a>
</li>
{% if current_user.has_permission(current_user.Permission.RelationsEntrepView, None) and scu and scu.is_entreprises_enabled() %}
<li class="nav-item"><a class="nav-link" href="{{ url_for('entreprises.index') }}">Entreprises</a></li>
{% endif %}
{% endif %}
</ul>
<ul class="navbar-nav ms-auto justify-content-end gap-3">
{% if current_user.is_anonymous %}
<li class="nav-item"><a class="nav-link" href="{{ url_for('auth.login') }}">connexion</a></li>
{% else %}
<li class="nav-item">{% if current_user.dept %}
<a class="nav-link" href="{{ url_for('users.user_info_page', scodoc_dept=current_user.dept, user_name=current_user.user_name )
}}">{{current_user.user_name}} ({{current_user.dept}})</a>
{% else %}
<a class="nav-link" href="">{{current_user.user_name}}</a>
{% endif %}
</li>
<li class="nav-item logout"><a class="nav-link" href="{{ url_for('auth.logout') }}">déconnexion</a></li>
{% endif %}
</ul>
</div>
</div>
</nav>
{% endblock %}
{% block content %}
{% include "flashed_messages.j2" %}
{# application content needs to be provided in the app_content block #}
<div class="container">
{% block app_content %}{{ content | safe }}{% endblock %}
</div>
<script>
setTimeout(function () {
var flashes = document.getElementsByClassName("flashes")[0];
if (flashes) {
flashes.style.display = "none";
}
}, 5000);
</script>
{% endblock %}
{% block scripts %}
{{ super() }}
<script src="{{scu.STATIC_DIR}}/libjs/menu.js"></script>
<script src="{{scu.STATIC_DIR}}/libjs/bubble.js"></script>
<script src="{{scu.STATIC_DIR}}/js/scodoc.js"></script>
<script>
const SCO_URL = "{% if g.scodoc_dept %}{{
url_for('scolar.index_html', scodoc_dept=g.scodoc_dept)}}{% endif %}";
</script>
{% endblock %}