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 */ /* Etudiant */
/************/ /************/
.info_etudiant{
color: #000;
text-decoration: none;
}
.etudiant{ .etudiant{
display: flex; display: flex;
align-items: center; align-items: center;
@ -194,6 +198,9 @@ h3{
.info{ .info{
opacity: 0.9; opacity: 0.9;
} }
.syntheseModule{
cursor: pointer;
}
.eval, .syntheseModule{ .eval, .syntheseModule{
position: relative; position: relative;
display: flex; display: flex;

View File

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

View File

@ -25,6 +25,7 @@
display: none; display: none;
}`; }`;
releve.shadowRoot.appendChild(style); releve.shadowRoot.appendChild(style);
}) });
document.querySelector("html").style.scrollBehavior = "smooth";
</script> </script>
{% endblock %} {% endblock %}