1
0
forked from ScoDoc/ScoDoc

update etud_info : func attach_etud_info

This commit is contained in:
Iziram 2024-08-23 16:09:46 +02:00
parent 10b7b876ea
commit 47f17157f1
2 changed files with 59 additions and 2 deletions

View File

@ -263,6 +263,8 @@ function creerLigneEtudiant(etud, index) {
// div index avec l'index
const indexDiv = document.createElement("div");
indexDiv.classList.add("index");
indexDiv.id = `etudid-${etud.id}`;
indexDiv.textContent = index;
ligneEtud.appendChild(indexDiv);
@ -280,6 +282,7 @@ function creerLigneEtudiant(etud, index) {
const nameSet = document.createElement("a");
nameSet.classList.add("name_set");
nameSet.id = `etudid-${etud.id}`;
nameSet.href = `bilan_etud?etudid=${etud.id}`;
const nom = document.createElement("h4");
@ -426,6 +429,12 @@ function creerLigneEtudiant(etud, index) {
ligneEtud.appendChild(btnsField);
// Attache les infos de l'étudiant (bulle etud_info)
try {
attach_etud_info(nameSet);
attach_etud_info(indexDiv);
} catch {}
return ligneEtud;
}

View File

@ -14,7 +14,7 @@ function get_etudid_from_elem(e) {
}
$().ready(function () {
if (typeof SCO_URL == 'undefined') {
if (typeof SCO_URL == "undefined") {
return;
}
var elems = $(".etudinfo:not(th)");
@ -38,7 +38,10 @@ $().ready(function () {
$(elems[i]).qtip({
content: {
ajax: {
url: `${SCO_URL}etud_info_html?etudid=` + get_etudid_from_elem(elems[i]) + qs,
url:
`${SCO_URL}etud_info_html?etudid=` +
get_etudid_from_elem(elems[i]) +
qs,
type: "GET",
//success: function(data, status) {
// this.set('content.text', data);
@ -63,3 +66,48 @@ $().ready(function () {
});
}
});
// Fonction pour attacher un tooltip a un élément
// e est l'élément HTML
// son id doit être de la forme "...-{etudid}"
// ou bien son id est "{etudid}"
function attach_etud_info(e) {
var q_args = get_query_args();
const args_to_pass = new Set([
"formsemestre_id",
"group_ids",
"group_id",
"partition_id",
"moduleimpl_id",
"evaluation_id",
]);
let qs = "";
for (var k in q_args) {
if (args_to_pass.has(k)) {
qs += "&" + k + "=" + q_args[k];
}
}
const etudid = get_etudid_from_elem(e);
$(e).qtip({
content: {
ajax: {
url: `${SCO_URL}etud_info_html?etudid=` + etudid + qs,
type: "GET",
},
},
text: "Loading...",
position: {
at: "right bottom",
my: "left top",
},
style: {
classes: "qtip-etud",
},
hide: {
fixed: true,
delay: 300,
},
// utile pour debugguer le css:
// hide: { event: 'unfocus' }
});
}