From b16d5193628e14872a79ad0064902b7475ce97fb Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Thu, 15 Aug 2024 00:04:35 +0200 Subject: [PATCH] Templates: partition_editor, ue_table, evaluation_listenotes --- app/scodoc/sco_edit_ue.py | 32 +++++++++++----------- app/templates/babase.j2 | 3 +++ app/templates/base.j2 | 5 ++-- app/templates/scolar/partition_editor.j2 | 34 ++++++++++++++++++------ app/views/notes.py | 13 +++++---- app/views/scolar.py | 30 +++++++-------------- 6 files changed, 62 insertions(+), 55 deletions(-) diff --git a/app/scodoc/sco_edit_ue.py b/app/scodoc/sco_edit_ue.py index 4acc3043d..154ae7422 100644 --- a/app/scodoc/sco_edit_ue.py +++ b/app/scodoc/sco_edit_ue.py @@ -764,20 +764,6 @@ def ue_table(formation_id=None, semestre_idx=1, msg=""): # was ue_list "delete_small_dis_img", title="Suppression impossible (module utilisé)" ) H = [ - html_sco_header.sco_header( - cssstyles=html_sco_header.BOOTSTRAP_MULTISELECT_CSS - + ["libjs/jQuery-tagEditor/jquery.tag-editor.css", "css/ue_table.css"], - javascripts=html_sco_header.BOOTSTRAP_MULTISELECT_JS - + [ - "libjs/jinplace-1.2.1.min.js", - "js/ue_list.js", - "js/edit_ue.js", - "libjs/jQuery-tagEditor/jquery.tag-editor.min.js", - "libjs/jQuery-tagEditor/jquery.caret.min.js", - "js/module_tag_editor.js", - ], - page_title=f"Formation {formation.acronyme} v{formation.version}", - ), f"""

{formation.html()} {lockicon}

""", @@ -1068,8 +1054,22 @@ du programme" (menu "Semestre") si vous avez un semestre en cours); warn, _ = sco_formsemestre_validation.check_formation_ues(formation) H.append(warn) - H.append(html_sco_header.sco_footer()) - return "".join(H) + return render_template( + "sco_page_dept.j2", + content="".join(H), + page_title=f"Formation {formation.acronyme} v{formation.version}", + cssstyles=html_sco_header.BOOTSTRAP_MULTISELECT_CSS + + ["libjs/jQuery-tagEditor/jquery.tag-editor.css", "css/ue_table.css"], + javascripts=html_sco_header.BOOTSTRAP_MULTISELECT_JS + + [ + "libjs/jinplace-1.2.1.min.js", + "js/ue_list.js", + "js/edit_ue.js", + "libjs/jQuery-tagEditor/jquery.tag-editor.min.js", + "libjs/jQuery-tagEditor/jquery.caret.min.js", + "js/module_tag_editor.js", + ], + ) def _html_select_semestre_idx(formation_id, semestre_ids, semestre_idx): diff --git a/app/templates/babase.j2 b/app/templates/babase.j2 index 2dc3aa89a..0c83381c2 100644 --- a/app/templates/babase.j2 +++ b/app/templates/babase.j2 @@ -13,6 +13,9 @@ + {% for css in cssstyles %} + + {% endfor %} {%- endblock styles %} {%- endblock head %} diff --git a/app/templates/base.j2 b/app/templates/base.j2 index 87bda5b78..663a31431 100644 --- a/app/templates/base.j2 +++ b/app/templates/base.j2 @@ -71,9 +71,8 @@ {% endblock %} {% block content %} -
- {% include "flashed_messages.j2" %} -
+ +{% include "flashed_messages.j2" %} {# application content needs to be provided in the app_content block #}
diff --git a/app/templates/scolar/partition_editor.j2 b/app/templates/scolar/partition_editor.j2 index a9de162e5..66fb7e499 100644 --- a/app/templates/scolar/partition_editor.j2 +++ b/app/templates/scolar/partition_editor.j2 @@ -1,15 +1,32 @@ {# -*- mode: jinja-html -*- #} +{% extends "sco_page.j2" %} -{% if not is_edt_configured %} - -{% endif %} +{% block title %} + Partitions de {{ formsemestre.titre_annee() }} +{% endblock title %} +{% block styles %} + {{ super() }} + + + {% if not is_edt_configured %} + + {% endif %} +{% endblock %} + + +{% block scripts %} + {{ super() }} + +{% endblock %} + +{% block app_content %}

{% if not read_only %}Édition des p{% else %}P{%endif%}artitions

- +

@@ -1024,3 +1041,4 @@ span.calendarEdit { } +{% endblock %} diff --git a/app/views/notes.py b/app/views/notes.py index 697eee5c4..587132cd1 100644 --- a/app/views/notes.py +++ b/app/views/notes.py @@ -1762,19 +1762,18 @@ def evaluation_listenotes(): raise ScoValueError("evaluation_listenotes: id invalides !") from exc fmt = vals.get("fmt", "html") - html_content, page_title = sco_liste_notes.do_evaluation_listenotes( + content, page_title = sco_liste_notes.do_evaluation_listenotes( evaluation_id=evaluation_id, moduleimpl_id=moduleimpl_id, fmt=fmt ) if fmt == "html": - H = html_sco_header.sco_header( - page_title=page_title, + return render_template( + "sco_page.j2", + content=content, + title=page_title, cssstyles=["css/verticalhisto.css"], javascripts=["js/etud_info.js"], ) - F = html_sco_header.sco_footer() - return H + html_content + F - else: - return html_content + return content sco_publish( diff --git a/app/views/scolar.py b/app/views/scolar.py index 92a8b1bc7..38a6cbfc7 100644 --- a/app/views/scolar.py +++ b/app/views/scolar.py @@ -944,27 +944,15 @@ def partition_editor(formsemestre_id: int, edit_partition=False): formsemestre: FormSemestre = FormSemestre.query.get_or_404(formsemestre_id) edit_partition = bool(int(edit_partition)) if edit_partition else False formsemestre.setup_parcours_groups() - H = [ - html_sco_header.sco_header( - cssstyles=["css/partition_editor.css"], - javascripts=[ - "js/partition_editor.js", - ], - page_title=f"Partitions de {formsemestre.titre_annee()}", - ), - """

""", - render_template( - "scolar/partition_editor.j2", - formsemestre=formsemestre, - read_only=not formsemestre.can_change_groups(), - edit_partition=edit_partition, - is_edt_configured=sco_edt_cal.is_edt_configured(), - scu=scu, - ), - html_sco_header.sco_footer(), - ] - - return "\n".join(H) + return render_template( + "scolar/partition_editor.j2", + formsemestre=formsemestre, + read_only=not formsemestre.can_change_groups(), + edit_partition=edit_partition, + is_edt_configured=sco_edt_cal.is_edt_configured(), + sco=ScoData(formsemestre=formsemestre), + scu=scu, + ) @bp.route("/students_groups_auto_assignment", methods=["GET", "POST"])