From 353671097430c837dc4c4fd5211accd6baf33a2e Mon Sep 17 00:00:00 2001 From: lehmann Date: Wed, 15 Feb 2023 21:27:00 +0100 Subject: [PATCH] Options de configuration partitions --- app/static/css/partition_editor.css | 27 +++++++++++++++++ app/templates/scolar/partition_editor.j2 | 38 +++++++++++++++++++++++- 2 files changed, 64 insertions(+), 1 deletion(-) diff --git a/app/static/css/partition_editor.css b/app/static/css/partition_editor.css index edf06108..b7841b42 100644 --- a/app/static/css/partition_editor.css +++ b/app/static/css/partition_editor.css @@ -297,6 +297,33 @@ body.editionActivated .filtres>div>div>div>div { border-radius: 8px; margin-bottom: 8px; position: relative; + display: grid; + grid-template-columns: 1fr auto; +} + +#zonePartitions .filtres .config { + grid-row: 1 / span 2; + grid-column: 2 / 3; + background: #424242; + color: #fff; + border-radius: 4px; + margin-left: 4px; + padding: 4px; + display: none; +} + +.editionActivated #zonePartitions .filtres .config { + display: block; +} + +#zonePartitions .filtres .config label{ + display: block; + background: #ddd; + border-radius: 4px; + padding: 2px; + color: #000; + margin-top: 2px; + cursor: pointer; } #zonePartitions .filtres .groupes { diff --git a/app/templates/scolar/partition_editor.j2 b/app/templates/scolar/partition_editor.j2 index 9695f51f..590f842b 100644 --- a/app/templates/scolar/partition_editor.j2 +++ b/app/templates/scolar/partition_editor.j2 @@ -182,7 +182,20 @@ Non affectés
+
- `; + + + +
+ Configuration +
+ + +
+ `; div.querySelector(".move").addEventListener("mousedown", moveStart); div.querySelector(".modif").addEventListener("click", editText); @@ -190,6 +203,8 @@ div.querySelector(".onoff").addEventListener("click", masquerPartitions); div.querySelector("[data-idgroupe]").addEventListener("click", filtre); div.querySelector(".ajoutGroupe").addEventListener("click", addGroupe); + div.querySelector(".rang").addEventListener("input", setAttribute); + div.querySelector(".groupe").addEventListener("input", setAttribute); return div; } @@ -797,6 +812,27 @@ }) } + /*****************/ + /* Config */ + /*****************/ + function setAttribute() { + fetch("partition_set_attr", + { + method: "post", + headers: { + "Content-type": "application/x-www-form-urlencoded; charset=UTF-8" + }, + body: `partition_id=${this.closest("[data-idpartition]").dataset.idpartition}&attr=${this.dataset.attr}&value=${this.checked?1:0}` + } + ).then(function(response) { + return response.text(); + }) + .then(function(txt) { + message(txt); + }); + + } + /*************************/ /* Message */ /*************************/