forked from ScoDoc/ScoDoc
Améliore sidebar avec template jinja
This commit is contained in:
parent
bec7deb581
commit
3666f8b1ec
@ -28,9 +28,8 @@
|
|||||||
"""
|
"""
|
||||||
Génération de la "sidebar" (marge gauche des pages HTML)
|
Génération de la "sidebar" (marge gauche des pages HTML)
|
||||||
"""
|
"""
|
||||||
from flask import url_for
|
from flask import render_template, url_for
|
||||||
from flask import g
|
from flask import g, request
|
||||||
from flask import request
|
|
||||||
from flask_login import current_user
|
from flask_login import current_user
|
||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
@ -168,19 +167,7 @@ def sidebar():
|
|||||||
|
|
||||||
def sidebar_dept():
|
def sidebar_dept():
|
||||||
"""Partie supérieure de la marge de gauche"""
|
"""Partie supérieure de la marge de gauche"""
|
||||||
H = [
|
return render_template(
|
||||||
f"""<h2 class="insidebar">Dépt. {sco_preferences.get_preference("DeptName")}</h2>
|
"sidebar_dept.html",
|
||||||
<a href="{url_for("scodoc.index")}" class="sidebar">Accueil</a> <br/> """
|
prefs=sco_preferences.SemPreferences(),
|
||||||
]
|
)
|
||||||
dept_intranet_url = sco_preferences.get_preference("DeptIntranetURL")
|
|
||||||
if dept_intranet_url:
|
|
||||||
H.append(
|
|
||||||
f"""<a href="{dept_intranet_url}" class="sidebar">{
|
|
||||||
sco_preferences.get_preference("DeptIntranetTitle")}</a> <br/>"""
|
|
||||||
)
|
|
||||||
# Entreprises pas encore supporté en ScoDoc8
|
|
||||||
# H.append(
|
|
||||||
# """<br/><a href="%(ScoURL)s/Entreprises" class="sidebar">Entreprises</a> <br/>"""
|
|
||||||
# % infos
|
|
||||||
# )
|
|
||||||
return "\n".join(H)
|
|
||||||
|
12
app/templates/sidebar_dept.html
Normal file
12
app/templates/sidebar_dept.html
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<h2 class="insidebar">Dépt. {{ prefs["DeptName"] }}</h2>
|
||||||
|
<a href="{{ url_for('scodoc.index') }}" class="sidebar">Accueil</a> <br/>
|
||||||
|
{% if prefs["DeptIntranetURL"] %}
|
||||||
|
<a href="{{ prefs["DeptIntranetURL"] }}" class="sidebar">
|
||||||
|
{{ prefs["DeptIntranetTitle"] }}</a>
|
||||||
|
{% endif %}
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
{#
|
||||||
|
# Entreprises pas encore supporté en ScoDoc8
|
||||||
|
# <br/><a href="%(ScoURL)s/Entreprises" class="sidebar">Entreprises</a> <br/>
|
||||||
|
#}
|
Loading…
Reference in New Issue
Block a user