From f63c1fadb8bef5d9feca2d5ff9c6a6e8597f02ec Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sat, 16 Apr 2022 15:48:17 +0200 Subject: [PATCH] Table semestre editable selon la permission --- app/scodoc/sco_dept.py | 5 ++++- app/static/js/scolar_index.js | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/scodoc/sco_dept.py b/app/scodoc/sco_dept.py index 6f0a75bdd..8c74fa65b 100644 --- a/app/scodoc/sco_dept.py +++ b/app/scodoc/sco_dept.py @@ -241,6 +241,9 @@ def _sem_table_gt(sems, showcodes=False): if showcodes: columns_ids = ("formsemestre_id",) + columns_ids + html_class = "stripe cell-border compact hover order-column table_leftalign semlist" + if current_user.has_permission(Permission.ScoEditApo): + html_class += " apo_editable" tab = GenTable( titles={ "formsemestre_id": "id", @@ -255,7 +258,7 @@ def _sem_table_gt(sems, showcodes=False): rows=sems, table_id="semlist", html_class_ignore_default=True, - html_class="stripe cell-border compact hover order-column table_leftalign semlist", + html_class=html_class, html_sortable=True, html_table_attrs=f"""data-apo_save_url="{url_for('notes.formsemestre_set_apo_etapes', scodoc_dept=g.scodoc_dept)}" """, html_with_td_classes=True, diff --git a/app/static/js/scolar_index.js b/app/static/js/scolar_index.js index befd846d6..4718e467e 100644 --- a/app/static/js/scolar_index.js +++ b/app/static/js/scolar_index.js @@ -15,7 +15,7 @@ $(document).ready(function () { "aaSorting": [], // Prevent initial sorting }; $('table.semlist').DataTable(table_options); - let apo_save_url = document.querySelector("table#semlist").dataset.apo_save_url; + let apo_save_url = document.querySelector("table#semlist.apo_editable").dataset.apo_save_url; apo_editor = new ScoFieldEditor(".etapes_apo_str", apo_save_url, false); });