From bdc6c90bfcfb8b907a7a735c7074851b56510a98 Mon Sep 17 00:00:00 2001
From: Iziram <matthias.hartmann@iziram.fr>
Date: Fri, 23 Aug 2024 17:30:23 +0200
Subject: [PATCH] update sco_formsemestre_status : hide tableau-modules on
 mobile

---
 app/scodoc/sco_formsemestre_status.py | 14 +++++++++++-
 app/static/css/scodoc97.css           | 32 +++++++++++++++++++++++++++
 app/static/css/scodoc9_mobile.css     |  4 ++++
 3 files changed, 49 insertions(+), 1 deletion(-)

diff --git a/app/scodoc/sco_formsemestre_status.py b/app/scodoc/sco_formsemestre_status.py
index 5f3d69ce..fe58bc15 100755
--- a/app/scodoc/sco_formsemestre_status.py
+++ b/app/scodoc/sco_formsemestre_status.py
@@ -1126,6 +1126,18 @@ def formsemestre_status(formsemestre_id=None, check_parcours=True):
         ]
         H += [
             f"""
+            <details id="tableau-modules-details" open>
+                <!-- script pour fermer automatiquement si mobile  -->
+                <script>
+                document.addEventListener("DOMContentLoaded", () => {{
+                    if (window.innerWidth < 769) {{
+                        document.getElementById("tableau-modules-details").open = false;
+                    }}
+                }});
+                </script>
+            <summary id="tableau-modules-summary">
+            <h3 title="cliquer pour afficher ou cacher le tableau">Tableau des Ressources et SAEs</h3>
+            </summary>
             <div class="tableau_modules">
             {_TABLEAU_MODULES_HEAD}
             <tr class="formsemestre_status_cat">
@@ -1155,7 +1167,7 @@ def formsemestre_status(formsemestre_id=None, check_parcours=True):
                     autres, nt, formsemestre, can_edit=can_edit, show_ues=False
                 ),
             ]
-        H += [_TABLEAU_MODULES_FOOT, "</div>"]
+        H += [_TABLEAU_MODULES_FOOT, "</div></details>"]
     else:
         # formations classiques: groupe par UE
         # élimine les modules BUT qui aurait pu se glisser là suite à un
diff --git a/app/static/css/scodoc97.css b/app/static/css/scodoc97.css
index 3c22c11f..38bfe85b 100644
--- a/app/static/css/scodoc97.css
+++ b/app/static/css/scodoc97.css
@@ -276,4 +276,36 @@ body {
     overflow: hidden !important;
     margin: 0 !important;
     height: 100vh !important;
+}
+
+/* Tableau des modules */
+#tableau-modules-summary {
+    list-style: none;
+}
+
+#tableau-modules-summary::marker {
+    display: none;
+}
+
+#tableau-modules-summary>h3::after {
+    content: "";
+    display: inline-block;
+    width: 0;
+    height: 0;
+    margin-left: 4px;
+    vertical-align: middle;
+    border-top: 4px dashed;
+    border-right: 4px solid transparent;
+    border-left: 4px solid transparent;
+}
+
+#tableau-modules-details:not([open])>#tableau-modules-summary>h3::before {
+    content: "(caché) ";
+    font-size: smaller;
+    font-weight: lighter;
+    font-style: italic;
+}
+
+#tableau-modules-details:not([open]) #tableau_modules {
+    display: none;
 }
\ No newline at end of file
diff --git a/app/static/css/scodoc9_mobile.css b/app/static/css/scodoc9_mobile.css
index 3dd227e0..ad1202df 100644
--- a/app/static/css/scodoc9_mobile.css
+++ b/app/static/css/scodoc9_mobile.css
@@ -101,4 +101,8 @@
         height: var(--size) !important;
     }
 
+    div.formsemestre_status {
+        padding: 0;
+    }
+
 }
\ No newline at end of file
-- 
GitLab