Fix bug and colors of text

This commit is contained in:
Thomas Forgione 2024-11-18 15:53:32 +01:00
parent 8d13713c5f
commit 62b6bb2417
2 changed files with 20 additions and 18 deletions

View File

@ -18,7 +18,7 @@
<div class="fixed-grid has-6-cols"> <div class="fixed-grid has-6-cols">
<div class="grid"> <div class="grid">
{% for project in projects %} {% for project in projects %}
<a href="#" id="project-{{ loop.index0 }}" class="cell p-2 has-text-centered has-text-white" style="border: solid; border-width: 1px; border-radius: 5px;"> <a href="#" id="project-{{ loop.index0 }}" class="cell p-2 has-text-centered has-text-white-dark" style="border: solid; border-width: 1px; border-radius: 5px;">
<div> <div>
<strong>{{ project.name }}</strong> <strong>{{ project.name }}</strong>
</div> </div>
@ -35,7 +35,7 @@
<div class="fixed-grid has-6-cols mb-5"> <div class="fixed-grid has-6-cols mb-5">
<div class="grid"> <div class="grid">
{% for object in project.objects %} {% for object in project.objects %}
<a href="/object/{{ object.id }}" class="cell p-2 has-text-centered has-text-white" style="border: solid; border-width: 1px; border-radius: 5px;"> <a href="/object/{{ object.id }}" class="cell p-2 has-text-centered has-text-white-dark" style="border: solid; border-width: 1px; border-radius: 5px;">
<div> <div>
<strong>{{ object.name }}</strong> <strong>{{ object.name }}</strong>
</div> </div>
@ -119,9 +119,9 @@ for (let i = 0; i < {{ projects | length }}; i++) {
if (same) { if (same) {
clickedProject.classList.remove('has-text-link'); clickedProject.classList.remove('has-text-link');
clickedProject.classList.add('has-text-white'); clickedProject.classList.add('has-text-white-dark');
} else { } else {
clickedProject.classList.remove('has-text-white'); clickedProject.classList.remove('has-text-white-dark');
clickedProject.classList.add('has-text-link'); clickedProject.classList.add('has-text-link');
} }
@ -129,7 +129,7 @@ for (let i = 0; i < {{ projects | length }}; i++) {
if (j !== i) { if (j !== i) {
let otherProject = document.getElementById('project-' + j); let otherProject = document.getElementById('project-' + j);
otherProject.classList.remove('has-text-link'); otherProject.classList.remove('has-text-link');
otherProject.classList.add('has-text-white'); otherProject.classList.add('has-text-white-dark');
} }
} }

View File

@ -42,7 +42,7 @@
</div> </div>
{% endif %} {% endif %}
<div class="control"> <div class="control">
<span id="delete-object" class="button is-danger">Supprimer cet objet</a> <button id="delete-object" class="button is-danger">Supprimer cet objet</button>
</div> </div>
</div> </div>
@ -83,23 +83,25 @@
</section> </section>
{% endblock content %} {% endblock content %}
{% block extrajs %}{% if calibration.state < CalibrationState.IsValidated %} {% block extrajs %}
<script> <script>
document.getElementById('scan').addEventListener('click', () => {
let modal = document.getElementById('calibration-modal');
modal.classList.add('is-active');
});
document.getElementById('delete-object').addEventListener('click', () => { document.getElementById('delete-object').addEventListener('click', () => {
let modal = document.getElementById('delete-modal'); let modal = document.getElementById('delete-modal');
modal.classList.add('is-active'); modal.classList.add('is-active');
}); });
document.getElementById('use-last-calibration-button').addEventListener('click', async () => { {% if calibration.state < CalibrationState.IsValidated %}
let resp = await fetch('/api/use-last-calibration'); document.getElementById('scan').addEventListener('click', () => {
await resp.text(); let modal = document.getElementById('calibration-modal');
window.location.href = '/scan/{{ object.id }}'; modal.classList.add('is-active');
}); });
document.getElementById('use-last-calibration-button').addEventListener('click', async () => {
let resp = await fetch('/api/use-last-calibration');
await resp.text();
window.location.href = '/scan/{{ object.id }}';
});
{% endif %}
(document.querySelectorAll('.modal-background, .modal-close, .custom-modal-close, .modal-card-head .delete, .modal-card-foot .button') || []).forEach((close) => { (document.querySelectorAll('.modal-background, .modal-close, .custom-modal-close, .modal-card-head .delete, .modal-card-foot .button') || []).forEach((close) => {
close.addEventListener('click', () => { close.addEventListener('click', () => {
@ -109,4 +111,4 @@
}); });
}); });
</script> </script>
{% endif %}{% endblock %} {% endblock %}