1
0
forked from ScoDoc/ScoDoc

Merge branch 'lehmann-master'

This commit is contained in:
Emmanuel Viennet 2021-12-23 00:17:27 +01:00
commit e7d2094f0b
3 changed files with 34 additions and 8 deletions

View File

@ -98,6 +98,10 @@ section>div:nth-child(1){
/************/
/* Etudiant */
/************/
.info_etudiant{
color: #000;
text-decoration: none;
}
.etudiant{
display: flex;
align-items: center;
@ -194,6 +198,9 @@ h3{
.info{
opacity: 0.9;
}
.syntheseModule{
cursor: pointer;
}
.eval, .syntheseModule{
position: relative;
display: flex;

View File

@ -27,6 +27,10 @@ class releveBUT extends HTMLElement {
moduleOnOff(){
this.parentElement.classList.toggle("moduleOnOff");
}
goTo(){
let module = this.dataset.module;
this.parentElement.parentElement.parentElement.parentElement.querySelector("#Module_" + module).scrollIntoView();
}
set setConfig(config){
this.config.showURL = config.showURL ?? this.config.showURL;
@ -46,6 +50,9 @@ class releveBUT extends HTMLElement {
this.shadow.querySelectorAll(".ue, .module").forEach(e => {
e.addEventListener("click", this.moduleOnOff)
})
this.shadow.querySelectorAll(".syntheseModule").forEach(e => {
e.addEventListener("click", this.goTo)
})
this.shadow.children[0].classList.add("ready");
}
@ -132,8 +139,15 @@ class releveBUT extends HTMLElement {
showInformations(data) {
this.shadow.querySelector(".studentPic").src = data.etudiant.photo_url || "default_Student.svg";
let output = `
<div class=info_etudiant>
let output = '';
if(this.config.showURL){
output += `<a href="${data.etudiant.fiche_url}" class=info_etudiant>`;
} else {
output += `<div class=info_etudiant>`;
}
output += `
<div class=civilite>
${this.civilite(data.etudiant.civilite)}
${data.etudiant.nom}
@ -150,8 +164,12 @@ class releveBUT extends HTMLElement {
Code INE : ${data.etudiant.code_ine}
</div>
<div>${data.formation.titre}</div>
</div>
`;
if(this.config.showURL){
output += `</a>`;
} else {
output += `</div>`;
}
this.shadow.querySelector(".infoEtudiant").innerHTML = output;
}
@ -226,8 +244,8 @@ class releveBUT extends HTMLElement {
let titre = data.ressources[module]?.titre || data.saes[module]?.titre;
let url = data.ressources[module]?.url || data.saes[module]?.url;
output += `
<div class=syntheseModule>
<div>${this.URL(url, `${module}&nbsp;- ${titre}`)}</div>
<div class=syntheseModule data-module="${module.replace(/[^a-zA-Z0-9]/g, "")}">
<div>${module}&nbsp;- ${titre}</div>
<div>
${dataModule.moyenne}
<em>Coef.&nbsp;${dataModule.coef}</em>
@ -249,7 +267,7 @@ class releveBUT extends HTMLElement {
let output = "";
Object.entries(module).forEach(([numero, content]) => {
output += `
<div>
<div id="Module_${numero.replace(/[^a-zA-Z0-9]/g, "")}">
<div class=module>
<h3>${this.URL(content.url, `${numero} - ${content.titre}`)}</h3>
<div>

View File

@ -22,9 +22,10 @@
.dateInscription,
.numerosEtudiant,
.dateNaissance{
display: none;
display: none;
}`;
releve.shadowRoot.appendChild(style);
})
});
document.querySelector("html").style.scrollBehavior = "smooth";
</script>
{% endblock %}