From d8511d048810e5ecb89cf091b7084663a474cf31 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 10 Jan 2025 21:00:45 +0100 Subject: [PATCH] New lock/unlock svg icons --- app/scodoc/sco_formsemestre_edit.py | 10 +++- app/scodoc/sco_formsemestre_status.py | 29 --------- app/scodoc/sco_utils.py | 10 +++- app/static/css/scodoc.css | 4 +- app/static/icons/lock_25.svg | 60 +++++++++++++++++++ app/static/icons/lock_25_open.svg | 38 ++++++++++++ app/templates/formsemestre_header.j2 | 12 ++-- app/templates/formsemestre_page_title.j2 | 44 -------------- .../jury/ue_list_etud_validations.j2 | 3 +- 9 files changed, 125 insertions(+), 85 deletions(-) create mode 100644 app/static/icons/lock_25.svg create mode 100644 app/static/icons/lock_25_open.svg delete mode 100644 app/templates/formsemestre_page_title.j2 diff --git a/app/scodoc/sco_formsemestre_edit.py b/app/scodoc/sco_formsemestre_edit.py index ee7a133a3..557765b3a 100644 --- a/app/scodoc/sco_formsemestre_edit.py +++ b/app/scodoc/sco_formsemestre_edit.py @@ -100,9 +100,13 @@ def formsemestre_editwithmodules(formsemestre_id: int): H = [] if not formsemestre.etat: H.append( - f"""

{scu.icontag( - "lock_img", border="0", title="Semestre verrouillé") - }Ce semestre est verrouillé.

""" + f"""

+ + { + scu.icontag("lock_25", file_format="svg", border="0", + height="64px", title="Semestre verrouillé") + } + Ce semestre est verrouillé.

""" ) else: r = do_formsemestre_createwithmodules(edit=True, formsemestre=formsemestre) diff --git a/app/scodoc/sco_formsemestre_status.py b/app/scodoc/sco_formsemestre_status.py index e4a404d18..5184143e8 100755 --- a/app/scodoc/sco_formsemestre_status.py +++ b/app/scodoc/sco_formsemestre_status.py @@ -479,35 +479,6 @@ def formsemestre_status_menubar(formsemestre: FormSemestre | None) -> str: ) -# Element HTML decrivant un semestre (barre de menu et infos) -def formsemestre_page_title(formsemestre_id=None): - """Element HTML decrivant un semestre (barre de menu et infos) - Cherche dans la requete si un semestre est défini - via (formsemestre_id ou moduleimpl ou evaluation ou group) - """ - formsemestre_id = ( - formsemestre_id - if formsemestre_id is not None - else retreive_formsemestre_from_request() - ) - # - if not formsemestre_id: - return "" - try: - formsemestre_id = int(formsemestre_id) - except ValueError: - log(f"formsemestre_id: invalid type {formsemestre_id:r}") - return "" - formsemestre = FormSemestre.get_formsemestre(formsemestre_id) - - return render_template( - "formsemestre_page_title.j2", - formsemestre=formsemestre, - scu=scu, - sem_menu_bar=formsemestre_status_menubar(formsemestre), - ) - - # --------- # ancienne fonction ScoDoc7 à supprimer lorsqu'on utilisera les modèles # utilisé seulement par export Apogée diff --git a/app/scodoc/sco_utils.py b/app/scodoc/sco_utils.py index 27ece1354..2fddd005a 100644 --- a/app/scodoc/sco_utils.py +++ b/app/scodoc/sco_utils.py @@ -1549,11 +1549,17 @@ ICONSIZES = {} # name : (width, height) cache image sizes def icontag(name, file_format="png", no_size=False, **attrs): """tag HTML pour un icone. (dans les versions anterieures on utilisait Zope) - Les icones sont des fichiers PNG dans .../static/icons + Les icones sont des fichiers PNG ou SVG dans .../static/icons Si la taille (width et height) n'est pas spécifiée, lit l'image pour la mesurer (et cache le résultat). + Si no_size, n'indique pas width / height dans l'élément html généré. + Pour les images SVG, width ou height doivent être spécifiés. """ - if (not no_size) and (("width" not in attrs) or ("height" not in attrs)): + if ( + file_format != "svg" + and (not no_size) + and (("width" not in attrs) or ("height" not in attrs)) + ): if name not in ICONSIZES: img_file = os.path.join( Config.SCODOC_DIR, diff --git a/app/static/css/scodoc.css b/app/static/css/scodoc.css index c996a03b7..9da9a87fb 100644 --- a/app/static/css/scodoc.css +++ b/app/static/css/scodoc.css @@ -1742,8 +1742,8 @@ formsemestre_page_title .eye img { formsemestre_page_title .lock img { display: inline-block; vertical-align: middle; - margin-bottom: 5px; - padding-right: 5px; + margin-left: 8px; + margin-right: 8px; } #formnotes .tf-explanation { diff --git a/app/static/icons/lock_25.svg b/app/static/icons/lock_25.svg new file mode 100644 index 000000000..1fe0f5fc3 --- /dev/null +++ b/app/static/icons/lock_25.svg @@ -0,0 +1,60 @@ + + + + + + + + diff --git a/app/static/icons/lock_25_open.svg b/app/static/icons/lock_25_open.svg new file mode 100644 index 000000000..a4ab5e9e9 --- /dev/null +++ b/app/static/icons/lock_25_open.svg @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + diff --git a/app/templates/formsemestre_header.j2 b/app/templates/formsemestre_header.j2 index 1e5019a91..85d603587 100644 --- a/app/templates/formsemestre_header.j2 +++ b/app/templates/formsemestre_header.j2 @@ -24,10 +24,14 @@ {{sco.formsemestre.inscriptions|length}} inscrits - {% if not sco.formsemestre.etat %}{{scu.icontag("lock_img", border="0", title="Semestre - verrouillé")|safe}} - {% endif %} + {{ + (scu.icontag("lock_25_open", file_format="svg", border="0", height="20px", title="Semestre déverrouillé") + if sco.formsemestre.etat else scu.icontag("lock_25", file_format="svg", border="0", height="20px", title="Semestre verrouillé")) + |safe + }} {% if not scu.is_passerelle_disabled() %} diff --git a/app/templates/formsemestre_page_title.j2 b/app/templates/formsemestre_page_title.j2 deleted file mode 100644 index 075faf9b1..000000000 --- a/app/templates/formsemestre_page_title.j2 +++ /dev/null @@ -1,44 +0,0 @@ -{# -*- mode: jinja-html -*- #} -{# Element HTML decrivant un semestre (barre de menu et infos) #} -{# was formsemestre_page_title #} - - \ No newline at end of file diff --git a/app/templates/jury/ue_list_etud_validations.j2 b/app/templates/jury/ue_list_etud_validations.j2 index c7557ffaa..2a003f135 100644 --- a/app/templates/jury/ue_list_etud_validations.j2 +++ b/app/templates/jury/ue_list_etud_validations.j2 @@ -25,7 +25,8 @@ {% else %} - {{ scu.icontag("lock_img", border="0", title="Semestre verrouillé")|safe }} + {{ scu.icontag("lock_25", file_format="svg", border="0", + height="20px", title="Semestre verrouillé")|safe }} {% endif %} {% endif %}