mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
#gzip #extract-inline-js enable gzip in nginx + move ~730 lines of inline JS to 15 external files
This commit is contained in:
@@ -63,7 +63,7 @@ if ($addMode) {
|
||||
}
|
||||
}
|
||||
?>
|
||||
<fieldset>
|
||||
<fieldset data-admin-mode="<?= $adminMode ? '1' : '0' ?>">
|
||||
<legend>Composition du jury</legend>
|
||||
|
||||
<!-- Promoteur·ice(s) interne -->
|
||||
@@ -141,36 +141,6 @@ if ($addMode) {
|
||||
+ Ajouter un·e promoteur·ice ULB
|
||||
</button>
|
||||
</fieldset>
|
||||
<?php if ($promoteurUlbConditional): ?>
|
||||
<script>
|
||||
(function() {
|
||||
try {
|
||||
var finalitySelect = document.querySelector('select[name="finality"]');
|
||||
var ulbRow = document.getElementById('jury-promoteur-ulb-row');
|
||||
if (!finalitySelect || !ulbRow) return;
|
||||
var ulbAsterisk = document.getElementById('jury-ulb-asterisk');
|
||||
function isApprofondiSelected() {
|
||||
var opt = finalitySelect.options[finalitySelect.selectedIndex];
|
||||
if (!opt) return false;
|
||||
return (opt.textContent || opt.text || '').toLowerCase().includes('approfondi');
|
||||
}
|
||||
function toggleUlb() {
|
||||
var show = isApprofondiSelected();
|
||||
ulbRow.style.display = show ? '' : 'none';
|
||||
if (ulbAsterisk) ulbAsterisk.style.display = show ? '' : 'none';
|
||||
var inputs = ulbRow.querySelectorAll('input[name="jury_promoteur_ulb_name[]"]');
|
||||
inputs.forEach(function(inp, idx) {
|
||||
inp.required = <?= $adminMode ? 'false' : 'show && idx === 0' ?>;
|
||||
inp.disabled = !show;
|
||||
if (!show) inp.value = '';
|
||||
});
|
||||
}
|
||||
finalitySelect.addEventListener('change', toggleUlb);
|
||||
toggleUlb();
|
||||
} catch(e) { console.error('jury ULB toggle:', e); }
|
||||
})();
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Lecteur·ice(s) interne -->
|
||||
@@ -235,21 +205,4 @@ if ($addMode) {
|
||||
|
||||
</fieldset>
|
||||
|
||||
<script>
|
||||
function addJuryRow(listId, inputName, roleLabel) {
|
||||
var list = document.getElementById(listId);
|
||||
if (!list) return;
|
||||
var n = list.querySelectorAll('.admin-jury-entry').length + 1;
|
||||
var div = document.createElement('div');
|
||||
div.className = 'admin-jury-entry';
|
||||
div.innerHTML = '<input type="text" name="' + inputName + '" placeholder="Nom" autocomplete="off"'
|
||||
+ ' aria-label="' + roleLabel + ' ' + n + ' \u2014 nom">'
|
||||
+ '<button type="button" class="btn btn--sm btn--ghost admin-btn-remove"'
|
||||
+ ' onclick="removeJuryRow(this)" aria-label="Supprimer">'
|
||||
+ '<span aria-hidden="true">\u2715</span></button>';
|
||||
list.appendChild(div);
|
||||
}
|
||||
function removeJuryRow(btn) {
|
||||
btn.closest('.admin-jury-entry').remove();
|
||||
}
|
||||
</script>
|
||||
<script src="<?= App::assetV('/assets/js/app/form-jury-fields.js') ?>"></script>
|
||||
|
||||
Reference in New Issue
Block a user