1
0
forked from ScoDoc/ScoDoc

Liens navigation sur saise jury BUT

This commit is contained in:
Emmanuel Viennet 2022-06-29 22:53:56 +02:00
parent e1cdc232f8
commit d227264283
6 changed files with 71 additions and 6 deletions

View File

@ -333,7 +333,10 @@ class RowCollector:
+ ((" " + scu.EMO_WARNING) if deca.nb_rcues_under_8 > 0 else ""),
"col_rcue col_rcues_validables" + klass,
)
self["_rcues_validables_data"] = {"etudid": deca.etud.id}
self["_rcues_validables_data"] = {
"etudid": deca.etud.id,
"nomprenom": deca.etud.nomprenom,
}
if len(deca.rcues_annee) > 0:
# permet un tri par nb de niveaux validables + moyenne gen indicative S_pair
if deca.res_pair and deca.etud.id in deca.res_pair.etud_moy_gen:

View File

@ -968,6 +968,8 @@ ICON_XLS = icontag("xlsicon_img", title="Version tableur")
# HTML emojis
EMO_WARNING = "⚠️" # warning /!\
EMO_RED_TRIANGLE_DOWN = "🔻" # red triangle pointed down
EMO_PREV_ARROW = "❮"
EMO_NEXT_ARROW = "❯"
def sort_dates(L, reverse=False):

View File

@ -11,4 +11,52 @@ function change_menu_code(elt) {
// TODO: comparer avec valeur enregistrée (à mettre en data-orig ?)
// et colorer en fonction
elt.parentElement.parentElement.classList.add("modified");
}
}
$(function () {
// Recupère la liste ordonnées des etudids
// pour avoir le "suivant" etr le "précédent"
// (liens de navigation)
const url = new URL(document.URL);
const frags = url.pathname.split("/"); // .../formsemestre_validation_but/formsemestre_id/etudid
const etudid = frags[frags.length - 1];
const formsemestre_id = frags[frags.length - 2];
const etudids_key = JSON.stringify(["etudids", url.origin, formsemestre_id]);
const etudids_str = localStorage.getItem(etudids_key);
const noms_key = JSON.stringify(["noms", url.origin, formsemestre_id]);
const noms_str = localStorage.getItem(noms_key);
if (etudids_str && noms_str) {
const etudids = JSON.parse(etudids_str);
const noms = JSON.parse(noms_str);
const cur_idx = etudids.indexOf(etudid);
let prev_idx = -1;
let next_idx = -1
if (cur_idx != -1) {
if (cur_idx > 0) {
prev_idx = cur_idx - 1;
}
if (cur_idx < etudids.length - 1) {
next_idx = cur_idx + 1;
}
}
if (prev_idx != -1) {
let elem = document.querySelector("div.prev a");
if (elem) {
elem.href = elem.href.replace("PREV", etudids[prev_idx]);
elem.innerHTML = noms[prev_idx];
}
} else {
document.querySelector("div.prev").innerHTML = "";
}
if (next_idx != -1) {
let elem = document.querySelector("div.next a");
if (elem) {
elem.href = elem.href.replace("NEXT", etudids[next_idx]);
elem.innerHTML = noms[next_idx];
}
} else {
document.querySelector("div.next").innerHTML = "";
}
}
});

View File

@ -192,6 +192,18 @@ $(function () {
if (formsemestre_id) {
localStorage.setItem(order_info_key, order_info);
}
let etudids = [];
document.querySelectorAll("td.col_rcues_validables").forEach(e => {
etudids.push(e.dataset.etudid);
});
let noms = [];
document.querySelectorAll("td.col_rcues_validables").forEach(e => {
noms.push(e.dataset.nomprenom);
});
const etudids_key = JSON.stringify(["etudids", url.origin, formsemestre_id]);
localStorage.setItem(etudids_key, JSON.stringify(etudids));
const noms_key = JSON.stringify(["noms", url.origin, formsemestre_id]);
localStorage.setItem(noms_key, JSON.stringify(noms));
},
"order": order_info,
}

View File

@ -2332,15 +2332,15 @@ def formsemestre_validation_but(
"""
)
# --- Navigation
prev = f"""<a href="{url_for(
prev = f"""{scu.EMO_PREV_ARROW}&nbsp;<a href="{url_for(
"notes.formsemestre_validation_but", scodoc_dept=g.scodoc_dept,
formsemestre_id=formsemestre_id, etudid="PREV"
)} class="stdlink"">précédent</a>
)}" class="stdlink"">précédent</a>
"""
next = f"""<a href="{url_for(
"notes.formsemestre_validation_but", scodoc_dept=g.scodoc_dept,
formsemestre_id=formsemestre_id, etudid="NEXT"
)} class="stdlink"">suivant</a>
)}" class="stdlink"">suivant</a>&nbsp;{scu.EMO_NEXT_ARROW}
"""
H.append(
f"""

View File

@ -1,7 +1,7 @@
# -*- mode: python -*-
# -*- coding: utf-8 -*-
SCOVERSION = "9.3.6"
SCOVERSION = "9.3.7"
SCONAME = "ScoDoc"