1
0
forked from ScoDoc/ScoDoc

Table semestre editable selon la permission

This commit is contained in:
Emmanuel Viennet 2022-04-16 15:48:17 +02:00
parent 2e6e7675bf
commit f63c1fadb8
2 changed files with 5 additions and 2 deletions

View File

@ -241,6 +241,9 @@ def _sem_table_gt(sems, showcodes=False):
if showcodes: if showcodes:
columns_ids = ("formsemestre_id",) + columns_ids 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( tab = GenTable(
titles={ titles={
"formsemestre_id": "id", "formsemestre_id": "id",
@ -255,7 +258,7 @@ def _sem_table_gt(sems, showcodes=False):
rows=sems, rows=sems,
table_id="semlist", table_id="semlist",
html_class_ignore_default=True, 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_sortable=True,
html_table_attrs=f"""data-apo_save_url="{url_for('notes.formsemestre_set_apo_etapes', scodoc_dept=g.scodoc_dept)}" """, 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, html_with_td_classes=True,

View File

@ -15,7 +15,7 @@ $(document).ready(function () {
"aaSorting": [], // Prevent initial sorting "aaSorting": [], // Prevent initial sorting
}; };
$('table.semlist').DataTable(table_options); $('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); apo_editor = new ScoFieldEditor(".etapes_apo_str", apo_save_url, false);
}); });