user_board: accès depuis accueil général
This commit is contained in:
parent
97eb18361f
commit
1a5072a35c
@ -42,6 +42,15 @@
|
|||||||
<li><a href="{{ url_for('entreprises.index') }}">Entreprises</a></li>
|
<li><a href="{{ url_for('entreprises.index') }}">Entreprises</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
|
{% if not current_user.is_anonymous %}
|
||||||
|
<ul class="nav navbar-nav">
|
||||||
|
<li>
|
||||||
|
<a href="{{
|
||||||
|
url_for('scodoc.user_board', user_name=current_user.user_name)
|
||||||
|
}}">Tableau de bord</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
<ul class="nav navbar-nav navbar-right">
|
<ul class="nav navbar-nav navbar-right">
|
||||||
{% if current_user.is_anonymous %}
|
{% if current_user.is_anonymous %}
|
||||||
<li><a href="{{ url_for('auth.login') }}">connexion</a></li>
|
<li><a href="{{ url_for('auth.login') }}">connexion</a></li>
|
||||||
@ -92,7 +101,8 @@
|
|||||||
<script src="{{scu.STATIC_DIR}}/libjs/qtip/jquery.qtip-3.0.3.min.js"></script>
|
<script src="{{scu.STATIC_DIR}}/libjs/qtip/jquery.qtip-3.0.3.min.js"></script>
|
||||||
<script src="{{scu.STATIC_DIR}}/js/scodoc.js"></script>
|
<script src="{{scu.STATIC_DIR}}/js/scodoc.js"></script>
|
||||||
<script>
|
<script>
|
||||||
const SCO_URL = "{{ url_for('scolar.index_html', scodoc_dept=g.scodoc_dept)[:-11] }}";
|
const SCO_URL = "{% if g.scodoc_dept %}{{
|
||||||
|
url_for('scolar.index_html', scodoc_dept=g.scodoc_dept)[:-11] }}{% endif %}";
|
||||||
const SCO_TIMEZONE = "{{ scu.TIME_ZONE }}";
|
const SCO_TIMEZONE = "{{ scu.TIME_ZONE }}";
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -1,6 +1,6 @@
|
|||||||
{# Tableau de bord utilisateur #}
|
{# Tableau de bord utilisateur #}
|
||||||
|
|
||||||
{% extends "sco_page.j2" %}
|
{% extends "base.j2" %}
|
||||||
|
|
||||||
{% block app_content %}
|
{% block app_content %}
|
||||||
<style>
|
<style>
|
||||||
@ -63,10 +63,12 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<h2>Votre tableau de bord, {{user.get_nomcomplet()}}</h2>
|
<h2>{{user.get_nomcomplet()}}</h2>
|
||||||
|
|
||||||
{% for dept_id in formsemestres_by_dept %}
|
{% for dept_id in formsemestres_by_dept %}
|
||||||
<h3>Modules dans le département {{ dept_names[dept_id] }}</h3>
|
<h3>Modules dans le <a class="stdlink" href="{{
|
||||||
|
url_for('scolar.index_html', scodoc_dept=depts[dept_id].acronym)}}"
|
||||||
|
>département {{ dept_names[dept_id] }}</a></h3>
|
||||||
<div class="ub-formsemestres">
|
<div class="ub-formsemestres">
|
||||||
{% for formsemestre in formsemestres_by_dept[dept_id] %}
|
{% for formsemestre in formsemestres_by_dept[dept_id] %}
|
||||||
<div class="ub-formsemestre">
|
<div class="ub-formsemestre">
|
||||||
|
@ -7,6 +7,7 @@ Emmanuel Viennet, 2023
|
|||||||
|
|
||||||
from flask import flash, redirect, render_template, url_for
|
from flask import flash, redirect, render_template, url_for
|
||||||
from flask import g, request
|
from flask import g, request
|
||||||
|
from flask_login import login_required
|
||||||
from app.auth.models import User
|
from app.auth.models import User
|
||||||
from app.decorators import (
|
from app.decorators import (
|
||||||
scodoc,
|
scodoc,
|
||||||
@ -15,14 +16,13 @@ from app.decorators import (
|
|||||||
from app.models import Departement, FormSemestre
|
from app.models import Departement, FormSemestre
|
||||||
from app.scodoc.sco_permissions import Permission
|
from app.scodoc.sco_permissions import Permission
|
||||||
from app.scodoc import sco_preferences
|
from app.scodoc import sco_preferences
|
||||||
from app.scodoc import sco_utils as scu
|
from app.views import scodoc_bp as bp
|
||||||
from app.views import scolar_bp as bp
|
|
||||||
from app.views import ScoData
|
from app.views import ScoData
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/user_board/<string:user_name>")
|
@bp.route("/ScoDoc/user_board/<string:user_name>")
|
||||||
@scodoc
|
@scodoc
|
||||||
@permission_required(Permission.ScoView)
|
@login_required
|
||||||
def user_board(user_name: str):
|
def user_board(user_name: str):
|
||||||
"""Tableau de bord utilisateur: liens vers ses objets"""
|
"""Tableau de bord utilisateur: liens vers ses objets"""
|
||||||
user = User.query.filter_by(user_name=user_name).first_or_404()
|
user = User.query.filter_by(user_name=user_name).first_or_404()
|
||||||
@ -30,6 +30,9 @@ def user_board(user_name: str):
|
|||||||
formsemestres_by_dept,
|
formsemestres_by_dept,
|
||||||
modimpls_by_formsemestre,
|
modimpls_by_formsemestre,
|
||||||
) = FormSemestre.get_user_formsemestres_annee_by_dept(user)
|
) = FormSemestre.get_user_formsemestres_annee_by_dept(user)
|
||||||
|
depts = {
|
||||||
|
dept_id: Departement.query.get(dept_id) for dept_id in formsemestres_by_dept
|
||||||
|
}
|
||||||
dept_names = {
|
dept_names = {
|
||||||
dept_id: sco_preferences.get_preference("DeptName", dept_id=dept_id)
|
dept_id: sco_preferences.get_preference("DeptName", dept_id=dept_id)
|
||||||
for dept_id in formsemestres_by_dept
|
for dept_id in formsemestres_by_dept
|
||||||
@ -41,6 +44,7 @@ def user_board(user_name: str):
|
|||||||
# TODO: le calendrier avec ses enseignements
|
# TODO: le calendrier avec ses enseignements
|
||||||
return render_template(
|
return render_template(
|
||||||
"user_board/user_board.j2",
|
"user_board/user_board.j2",
|
||||||
|
depts=depts,
|
||||||
dept_names=dept_names_sorted,
|
dept_names=dept_names_sorted,
|
||||||
formsemestres_by_dept=formsemestres_by_dept,
|
formsemestres_by_dept=formsemestres_by_dept,
|
||||||
modimpls_by_formsemestre=modimpls_by_formsemestre,
|
modimpls_by_formsemestre=modimpls_by_formsemestre,
|
||||||
|
Loading…
Reference in New Issue
Block a user