From 3cecfbb6978496df31e1dc8ab378f8435ecbe73d Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 29 Jul 2024 21:43:34 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20d=C3=A9tails=20sur=20tables=20recap=20ave?= =?UTF-8?q?c=20nouvelle=20version=20de=20datatables.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/static/css/gt_table.css | 10 ++++++++++ app/static/css/scodoc.css | 8 ++++---- app/static/js/table_recap.js | 13 ++++++++++++- app/tables/table_builder.py | 4 +++- sco_version.py | 2 +- scodoc.py | 1 + 6 files changed, 31 insertions(+), 7 deletions(-) diff --git a/app/static/css/gt_table.css b/app/static/css/gt_table.css index 9d04b0de..2e8253e6 100644 --- a/app/static/css/gt_table.css +++ b/app/static/css/gt_table.css @@ -46,4 +46,14 @@ table.dataTable tr.gt_lastrow th { table.dataTable td.etudinfo, table.dataTable td.group { text-align: left; +} + +div.dt-container div.dt-search { + display: inline-block; + margin-left: 16px; + margin-top: 4px; +} + +div.dt-container div.dt-search input { + margin-left: 0.5em; } \ No newline at end of file diff --git a/app/static/css/scodoc.css b/app/static/css/scodoc.css index 2e759722..7fede43e 100644 --- a/app/static/css/scodoc.css +++ b/app/static/css/scodoc.css @@ -4367,7 +4367,7 @@ div.table_recap { } .table_recap .but_on { - background-color: rgb(177, 238, 162); + background-color: rgb(177, 238, 162) !important; font-weight: bold; } @@ -4381,17 +4381,17 @@ button.unselect { .table_recap div.but_on:hover:not(.disabled), .table_recap a.but_on:hover:not(.disabled), .table_recap input.but_on:hover:not(.disabled) { - background: linear-gradient(to bottom, lightgray 0%, rgb(51, 255, 0) 100%); + background: linear-gradient(to bottom, lightgray 0%, rgb(255, 0, 0) 100%) !important; } .table_recap button.but_off:hover:not(.disabled), .table_recap div.but_off:hover:not(.disabled), .table_recap a.but_off:hover:not(.disabled), .table_recap input.but_off:hover:not(.disabled) { - background: linear-gradient(to bottom, rgb(51, 255, 0) 0%, lightgray 100%); + background: linear-gradient(to bottom, rgb(51, 255, 0) 0%, lightgray 100%) !important; } -/* Non supproté par les navigateurs (en Fev. 2023) +/* Non supporté par les navigateurs (en Fev. 2023) .table_recap button:has(span a.clearreaload) { } */ diff --git a/app/static/js/table_recap.js b/app/static/js/table_recap.js index 031d791f..8b861b75 100644 --- a/app/static/js/table_recap.js +++ b/app/static/js/table_recap.js @@ -206,11 +206,22 @@ $(function () { fixedColumns: { // fige les 3 colonnes de gauche start: 3 }, + initComplete: function (settings, json) { + // fixe la largeur de la table (évite décalages colonnes) + document.getElementById("DataTables_Table_0").style.width = + document.querySelector( + "#DataTables_Table_0_wrapper .dt-scroll-head .dt-scroll-headInner" + ).style.width; + // déplace champ recherche à côté des boutons + let div_search = document.querySelector('div.dt-search'); + let div_buttons = document.querySelector('div.dt-buttons'); + div_buttons.appendChild(div_search); + }, fixedHeader: { // fige les lignes de titre header: true, footer: false, }, - orderCellsTop: true, // cellules ligne 1 pour tri + ordering: true, // bouton tri aaSorting: [], // Prevent initial sorting colReorder: true, stateSave: true, // enregistre état de la table (tris, ...) diff --git a/app/tables/table_builder.py b/app/tables/table_builder.py index d7e01358..cec24081 100644 --- a/app/tables/table_builder.py +++ b/app/tables/table_builder.py @@ -565,6 +565,8 @@ class RowGroupsHeader(Row): ): idx += 1 colspan += 1 - elements.append(f"""{group_title or ""}""") + elements.append( + f"""{group_title or ""}""" + ) return "\n".join(elements) if len(elements) > 1 else "" diff --git a/sco_version.py b/sco_version.py index c05bb398..1d70b4ec 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.7.R000" +SCOVERSION = "9.7.R001" SCONAME = "ScoDoc" diff --git a/scodoc.py b/scodoc.py index 95511399..e2bdc281 100755 --- a/scodoc.py +++ b/scodoc.py @@ -386,6 +386,7 @@ def user_role(username, dept_acronym=None, add_role_name=None, remove_role_name= if user_role: db.session.delete(user_role) db.session.commit() + return 0 @app.cli.command()