From bdf47d92406a7944ba02ab0d51557ce18f8e351f Mon Sep 17 00:00:00 2001 From: ilona Date: Mon, 21 Oct 2024 12:35:24 +0200 Subject: [PATCH 1/2] =?UTF-8?q?Fix=20regressions:=20=C3=A9dition=20formati?= =?UTF-8?q?on.=20+=20am=C3=A9liore=20pr=C3=A9sentation.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scodoc/gen_tables.py | 4 +- app/scodoc/sco_edit_apc.py | 51 +++++++++++----------- app/static/css/gt_table.css | 5 +++ app/static/css/scodoc.css | 25 +++-------- app/templates/pn/form_ues.j2 | 2 +- app/views/notes.py | 83 ++++++++++++++++++++++-------------- 6 files changed, 89 insertions(+), 81 deletions(-) diff --git a/app/scodoc/gen_tables.py b/app/scodoc/gen_tables.py index b5ce3e6de..5820d20a3 100644 --- a/app/scodoc/gen_tables.py +++ b/app/scodoc/gen_tables.py @@ -494,7 +494,7 @@ class GenTable: caption = self.html_caption or self.caption if caption or self.base_url: - H.append('

') + H.append('

') if caption: H.append(caption) if self.base_url: @@ -512,7 +512,7 @@ class GenTable: }">{scu.ICON_PDF}""" ) H.append("") - H.append("

") + H.append("
") H.append(self.html_next_section) return "\n".join(H) diff --git a/app/scodoc/sco_edit_apc.py b/app/scodoc/sco_edit_apc.py index 8943b2342..ab5e2d7eb 100644 --- a/app/scodoc/sco_edit_apc.py +++ b/app/scodoc/sco_edit_apc.py @@ -71,19 +71,17 @@ def html_edit_formation_apc( ues_by_sem = {} ects_by_sem = {} - for semestre_idx in semestre_ids: - ues_by_sem[semestre_idx] = formation.ues.filter_by( - semestre_idx=semestre_idx - ).order_by(UniteEns.semestre_idx, UniteEns.numero, UniteEns.acronyme) - ects = [ - ue.ects - for ue in ues_by_sem[semestre_idx] - if ue.type != codes_cursus.UE_SPORT - ] + for s_idx in semestre_ids: + ues_by_sem[s_idx] = ( + formation.ues.filter_by(semestre_idx=s_idx) + .order_by(UniteEns.semestre_idx, UniteEns.numero, UniteEns.acronyme) + .all() + ) + ects = [ue.ects for ue in ues_by_sem[s_idx] if ue.type != codes_cursus.UE_SPORT] if None in ects: - ects_by_sem[semestre_idx] = 'manquant' + ects_by_sem[s_idx] = 'manquant' else: - ects_by_sem[semestre_idx] = f"{sum(ects):g}" + ects_by_sem[s_idx] = f"{sum(ects):g}" arrow_up, arrow_down, arrow_none = sco_groups.get_arrow_icons_tags() @@ -124,14 +122,14 @@ def html_edit_formation_apc( ues_by_sem=ues_by_sem, ), ] - for semestre_idx in semestre_ids: - ressources_in_sem = ressources.filter_by(semestre_id=semestre_idx) - saes_in_sem = saes.filter_by(semestre_id=semestre_idx) - other_modules_in_sem = other_modules.filter_by(semestre_id=semestre_idx) + for s_idx in semestre_ids: + ressources_in_sem = ressources.filter_by(semestre_id=s_idx) + saes_in_sem = saes.filter_by(semestre_id=s_idx) + other_modules_in_sem = other_modules.filter_by(semestre_id=s_idx) matiere_parent = Matiere.query.filter( Matiere.ue_id == UniteEns.id, UniteEns.formation_id == formation.id, - UniteEns.semestre_idx == semestre_idx, + UniteEns.semestre_idx == s_idx, UniteEns.type != codes_cursus.UE_SPORT, ).first() H += [ @@ -139,7 +137,7 @@ def html_edit_formation_apc( render_template( "pn/form_mods.j2", formation=formation, - titre=f"Ressources du S{semestre_idx}", + titre=f"Ressources du S{s_idx}", create_element_msg="créer une nouvelle ressource", # matiere_parent=matiere_parent, modules=ressources_in_sem, @@ -148,16 +146,16 @@ def html_edit_formation_apc( tag_editable=tag_editable, icons=icons, scu=scu, - semestre_id=semestre_idx, + semestre_id=s_idx, ) - if ues_by_sem[semestre_idx].count() > 0 + if len(ues_by_sem[s_idx]) > 0 else "" ), ( render_template( "pn/form_mods.j2", formation=formation, - titre=f"Situations d'Apprentissage et d'Évaluation (SAÉs) S{semestre_idx}", + titre=f"Situations d'Apprentissage et d'Évaluation (SAÉs) S{s_idx}", create_element_msg="créer une nouvelle SAÉ", # matiere_parent=matiere_parent, modules=saes_in_sem, @@ -166,16 +164,16 @@ def html_edit_formation_apc( tag_editable=tag_editable, icons=icons, scu=scu, - semestre_id=semestre_idx, + semestre_id=s_idx, ) - if ues_by_sem[semestre_idx].count() > 0 + if len(ues_by_sem[s_idx]) > 0 else "" ), ( render_template( "pn/form_mods.j2", formation=formation, - titre=f"Autres modules (non BUT) du S{semestre_idx}", + titre=f"Autres modules (non BUT) du S{s_idx}", create_element_msg="créer un nouveau module", modules=other_modules_in_sem, module_type=ModuleType.STANDARD, @@ -183,10 +181,11 @@ def html_edit_formation_apc( tag_editable=tag_editable, icons=icons, scu=scu, - semestre_id=semestre_idx, + semestre_id=s_idx, ) - if ues_by_sem[semestre_idx].count() > 0 - else """créer une UE pour pouvoir ajouter des modules""" + if len(ues_by_sem[s_idx]) > 0 + else """créer une UE pour pouvoir ajouter des + modules""" ), ] diff --git a/app/static/css/gt_table.css b/app/static/css/gt_table.css index 2e8253e60..0e57dd250 100644 --- a/app/static/css/gt_table.css +++ b/app/static/css/gt_table.css @@ -56,4 +56,9 @@ div.dt-container div.dt-search { div.dt-container div.dt-search input { margin-left: 0.5em; +} + +div.gt_caption { + margin-top: 4px; + margin-bottom: 16px; } \ No newline at end of file diff --git a/app/static/css/scodoc.css b/app/static/css/scodoc.css index 06234400e..19fb76456 100644 --- a/app/static/css/scodoc.css +++ b/app/static/css/scodoc.css @@ -131,6 +131,11 @@ div.scobox-etud { background-color: var(--sco-color-background); } + +ul.sco-links li { + margin-bottom: 8px; +} + /* customization of multiselect style */ .multiselect-container.dropdown-menu { background-color: #e9e9e9; @@ -4091,26 +4096,6 @@ div.scobox.update_warning>div:nth-child(2) { padding-left: 8ex; } -/* - Titres des tabs: - .nav-tabs li a { - font-variant: small-caps; - font-size: 13pt; - } - - #group-tabs { - clear: both; - } - - #group-tabs ul { - display: inline; - } - - #group-tabs ul li { - display: inline; - } -*/ - /* Page accueil */ #scodoc_attribution p { font-size: 75%; diff --git a/app/templates/pn/form_ues.j2 b/app/templates/pn/form_ues.j2 index 255605afe..9369b1320 100644 --- a/app/templates/pn/form_ues.j2 +++ b/app/templates/pn/form_ues.j2 @@ -118,7 +118,7 @@ {% if editable %}