Merge branch 'table' of https://scodoc.org/git/ScoDoc/ScoDoc into bac_a_sable_prod

This commit is contained in:
ScoDoc service 2023-05-12 10:01:08 +02:00
commit 0c215565e8
5 changed files with 77 additions and 69 deletions

View File

@ -1,27 +1,4 @@
function getCurrentScriptPath() {
// Get all the script elements on the page
var scripts = document.getElementsByTagName('script');
// Find the last script element (which is the currently executing script)
var currentScript = scripts[scripts.length - 1];
// Retrieve the src attribute of the script element
var scriptPath = currentScript.src;
return scriptPath;
}
function removeLastTwoComponents(path) {
// Split the path into individual components
var components = path.split('/');
// Remove the last two components (filename and enclosing directory)
components.splice(-2);
// Join the remaining components back into a path
var newPath = components.join('/');
return newPath;
}
class ref_competences extends HTMLElement { class ref_competences extends HTMLElement {
constructor() { constructor() {
super(); super();

View File

@ -15,8 +15,8 @@ class releveBUT extends HTMLElement {
/* Style du module */ /* Style du module */
const styles = document.createElement('link'); const styles = document.createElement('link');
styles.setAttribute('rel', 'stylesheet'); styles.setAttribute('rel', 'stylesheet');
if (location.href.split("/")[3] == "ScoDoc") { if (location.href.includes("ScoDoc")) {
styles.setAttribute('href', '/ScoDoc/static/css/releve-but.css'); // Scodoc styles.setAttribute('href', removeLastTwoComponents(getCurrentScriptPath()) + '/css/releve-but.css'); // Scodoc
} else { } else {
styles.setAttribute('href', '/assets/styles/releve-but.css'); // Passerelle styles.setAttribute('href', '/assets/styles/releve-but.css'); // Passerelle
} }
@ -212,8 +212,8 @@ class releveBUT extends HTMLElement {
this.shadow.querySelector("#identite_etudiant").innerHTML = ` <a href="${data.etudiant.fiche_url}">${data.etudiant.nomprenom}</a> `; this.shadow.querySelector("#identite_etudiant").innerHTML = ` <a href="${data.etudiant.fiche_url}">${data.etudiant.nomprenom}</a> `;
this.shadow.querySelector(".dateInscription").innerHTML += this.ISOToDate(data.semestre.inscription); this.shadow.querySelector(".dateInscription").innerHTML += this.ISOToDate(data.semestre.inscription);
let output = ''; let output = '';
if(!data.options.block_moyenne_generale){ if (!data.options.block_moyenne_generale) {
output += ` output += `
<div> <div>
<div class=enteteSemestre>Moyenne</div><div class=enteteSemestre>${data.semestre.notes.value}</div> <div class=enteteSemestre>Moyenne</div><div class=enteteSemestre>${data.semestre.notes.value}</div>
<div class=rang>Rang :</div><div class=rang>${data.semestre.rang.value} / ${data.semestre.rang.total}</div> <div class=rang>Rang :</div><div class=rang>${data.semestre.rang.value} / ${data.semestre.rang.total}</div>
@ -333,7 +333,7 @@ class releveBUT extends HTMLElement {
} else { } else {
output += ` output += `
<div> <div>
<div class="ue ${dataUE.date_capitalisation?"capitalisee":""}"> <div class="ue ${dataUE.date_capitalisation ? "capitalisee" : ""}">
<h3> <h3>
${ue}${(dataUE.titre) ? " - " + dataUE.titre : ""} ${ue}${(dataUE.titre) ? " - " + dataUE.titre : ""}
</h3> </h3>
@ -341,7 +341,7 @@ class releveBUT extends HTMLElement {
<div class=moyenne>Moyenne&nbsp;:&nbsp;${dataUE.moyenne?.value || dataUE.moyenne || "-"}</div> <div class=moyenne>Moyenne&nbsp;:&nbsp;${dataUE.moyenne?.value || dataUE.moyenne || "-"}</div>
<div class=ue_rang>Rang&nbsp;:&nbsp;${dataUE.moyenne?.rang}&nbsp;/&nbsp;${dataUE.moyenne?.total}</div> <div class=ue_rang>Rang&nbsp;:&nbsp;${dataUE.moyenne?.rang}&nbsp;/&nbsp;${dataUE.moyenne?.total}</div>
<div class=info>`; <div class=info>`;
if(!dataUE.date_capitalisation){ if (!dataUE.date_capitalisation) {
output += ` Bonus&nbsp;:&nbsp;${dataUE.bonus || 0}&nbsp;- output += ` Bonus&nbsp;:&nbsp;${dataUE.bonus || 0}&nbsp;-
Malus&nbsp;:&nbsp;${dataUE.malus || 0}`; Malus&nbsp;:&nbsp;${dataUE.malus || 0}`;
} else { } else {
@ -359,12 +359,12 @@ class releveBUT extends HTMLElement {
</div>*/ </div>*/
output += "</div>"; output += "</div>";
if(!dataUE.date_capitalisation){ if (!dataUE.date_capitalisation) {
output += output +=
this.synthese(data, dataUE.ressources) + this.synthese(data, dataUE.ressources) +
this.synthese(data, dataUE.saes); this.synthese(data, dataUE.saes);
} }
output += "</div>"; output += "</div>";
} }
}); });

View File

@ -256,3 +256,27 @@ class ScoFieldEditor {
} }
} }
function getCurrentScriptPath() {
// Get all the script elements on the page
var scripts = document.getElementsByTagName('script');
// Find the last script element (which is the currently executing script)
var currentScript = scripts[scripts.length - 1];
// Retrieve the src attribute of the script element
var scriptPath = currentScript.src;
return scriptPath;
}
function removeLastTwoComponents(path) {
// Split the path into individual components
var components = path.split('/');
// Remove the last two components (filename and enclosing directory)
components.splice(-2);
// Join the remaining components back into a path
var newPath = components.join('/');
return newPath;
}

View File

@ -7,43 +7,50 @@
{% block app_content %} {% block app_content %}
{% include 'bul_head.j2' %} {% include 'bul_head.j2' %}
<releve-but></releve-but> <releve-but></releve-but>
<script src="{{scu.STATIC_DIR}}/js/releve-but.js"></script>
{% include 'bul_foot.j2' %} {% include 'bul_foot.j2' %}
<script> {% endblock %}
let dataSrc = "{{bul_url|safe}}";
fetch(dataSrc)
.then(r => { return r.json() })
.then(json => {
let releve = document.querySelector("releve-but");
releve.showData = json;
// Syle custom à ajouter
let style = document.createElement("style");
style.textContent = `
.module>div,
.dateInscription,
.numerosEtudiant,
.dateNaissance{
display: none;
}`;
releve.shadowRoot.appendChild(style);
});
// .catch(error => {
// let div = document.createElement("div");
// div.innerText = "Une erreur s'est produite lors du transfert des données.";
// div.style.fontSize = "24px";
// div.style.color = "#d93030";
// let releve = document.querySelector("releve-but"); {% block scripts %}
// releve.after(div); {{super()}}
// releve.remove();
// throw 'Fin du script - données invalides'; <script src="{{scu.STATIC_DIR}}/js/releve-but.js"></script>
// });
document.querySelector("html").style.scrollBehavior = "smooth"; <script>
</script> let dataSrc = "{{bul_url|safe}}";
{% endblock %} fetch(dataSrc)
.then(r => { return r.json() })
.then(json => {
let releve = document.querySelector("releve-but");
releve.showData = json;
// Syle custom à ajouter
let style = document.createElement("style");
style.textContent = `
.module>div,
.dateInscription,
.numerosEtudiant,
.dateNaissance{
display: none;
}`;
releve.shadowRoot.appendChild(style);
});
// .catch(error => {
// let div = document.createElement("div");
// div.innerText = "Une erreur s'est produite lors du transfert des données.";
// div.style.fontSize = "24px";
// div.style.color = "#d93030";
// let releve = document.querySelector("releve-but");
// releve.after(div);
// releve.remove();
// throw 'Fin du script - données invalides';
// });
document.querySelector("html").style.scrollBehavior = "smooth";
</script>
{% endblock %}

View File

@ -19,8 +19,6 @@
<ref-competences></ref-competences> <ref-competences></ref-competences>
</div> </div>
<script src="{{scu.STATIC_DIR}}/js/ref_competences.js"></script>
{% include "but/refcomp_parcours_niveaux.j2" %} {% include "but/refcomp_parcours_niveaux.j2" %}
@ -49,6 +47,8 @@
{% block scripts %} {% block scripts %}
{{super()}} {{super()}}
<script src="{{scu.STATIC_DIR}}/js/ref_competences.js"></script>
<script> <script>
$(function () { $(function () {
let data_url = "{{data_source}}"; let data_url = "{{data_source}}";