mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-07 03:29:19 +02:00
Increase touch/click target sizes to meet WCAG 2.5.5 (minimum 44×44px for navigation, 32px for admin UI controls): - main.css / search.css: pagination buttons 2rem → min-height/min-width 2.75rem (44px). Changed display to inline-flex for proper centering. - admin.css: .admin-btn-sm gains min-height: 2rem (32px) and switches to inline-flex so the constraint is respected. - admin.css: .admin-btn-remove (jury ✕ buttons) gains min-height: 2rem and inline-flex display + explicit cursor:pointer. WCAG 2.5.3 label-in-name — jury remove buttons already had aria-label; wrap the visible ✕ glyph in <span aria-hidden='true'> so screen readers hear only the aria-label, not the symbol: - templates/partials/form/jury-fieldset.php: all three ✕ occurrences (static PHP blocks + JS-generated innerHTML string) wrapped. WCAG 4.1.2 / semantic HTML: - admin/index.php: add role='toolbar' aria-label='Actions groupées' to the bulk-actions bar.
108 lines
5.4 KiB
PHP
108 lines
5.4 KiB
PHP
<?php
|
|
/**
|
|
* Jury composition fieldset partial.
|
|
*
|
|
* Variables consumed (all optional — defaults to empty/add-mode):
|
|
* $juryPresident string|null President name
|
|
* $juryPromoteur string|null Promoteur name
|
|
* $juryPromoteurExt int 1 if promoteur is external, 0 otherwise
|
|
* $juryLecteurs array Each element: ['name' => string, 'is_external' => int]
|
|
*
|
|
* In "add" mode (no existing jury data), callers should pass nulls/empty arrays and
|
|
* may rely on the $formData repopulation helpers (old/wasSelected) defined in add.php.
|
|
* When those helpers exist and no explicit values are set, the partial uses them.
|
|
*/
|
|
|
|
$juryPresident = $juryPresident ?? null;
|
|
$juryPromoteur = $juryPromoteur ?? null;
|
|
$juryPromoteurExt = $juryPromoteurExt ?? 0;
|
|
$juryLecteurs = $juryLecteurs ?? [];
|
|
|
|
// In add-mode, repopulate from flash form data when helpers are available.
|
|
$addMode = ($juryPresident === null && $juryPromoteur === null && empty($juryLecteurs));
|
|
if ($addMode && function_exists('old')) {
|
|
$juryPresident = old('jury_president') ?: null;
|
|
$juryPromoteur = old('jury_promoteur') ?: null;
|
|
$juryPromoteurExt = function_exists('wasSelected') && wasSelected('jury_promoteur_ext', '1') ? 1 : 0;
|
|
}
|
|
|
|
$juryIdx = max(count($juryLecteurs), 1);
|
|
?>
|
|
<!-- Composition du jury -->
|
|
<fieldset>
|
|
<legend>Composition du jury</legend>
|
|
|
|
<!-- Président·e -->
|
|
<div>
|
|
<label for="jury_president">Président·e :</label>
|
|
<input type="text" id="jury_president" name="jury_president"
|
|
value="<?= htmlspecialchars($juryPresident ?? '') ?>"
|
|
placeholder="Nom du/de la président·e (interne)">
|
|
</div>
|
|
|
|
<!-- Promoteur·ice -->
|
|
<div>
|
|
<label for="jury_promoteur">Promoteur·ice :</label>
|
|
<div class="admin-jury-row">
|
|
<input type="text" id="jury_promoteur" name="jury_promoteur"
|
|
value="<?= htmlspecialchars($juryPromoteur ?? '') ?>" placeholder="Nom">
|
|
<label class="admin-checkbox-label admin-jury-ext">
|
|
<input type="checkbox" name="jury_promoteur_ext" value="1"
|
|
<?= $juryPromoteurExt ? 'checked' : '' ?>> Externe
|
|
</label>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Lecteur·ices (dynamic list) -->
|
|
<div>
|
|
<label>Lecteur·ices :</label>
|
|
<div>
|
|
<div id="jury-lecteurs-list" class="admin-jury-list">
|
|
<?php if (empty($juryLecteurs)): ?>
|
|
<div class="admin-jury-entry">
|
|
<input type="text" name="jury_lecteurs[]" placeholder="Nom">
|
|
<label class="admin-checkbox-label admin-jury-ext">
|
|
<input type="checkbox" name="jury_lecteurs_ext[0]" value="1"> Externe
|
|
</label>
|
|
<button type="button" class="admin-btn-remove" onclick="removeJuryRow(this)"
|
|
aria-label="Supprimer ce lecteur"><span aria-hidden="true">✕</span></button>
|
|
</div>
|
|
<?php else: ?>
|
|
<?php foreach ($juryLecteurs as $li => $lm): ?>
|
|
<div class="admin-jury-entry">
|
|
<input type="text" name="jury_lecteurs[]"
|
|
value="<?= htmlspecialchars($lm['name']) ?>" placeholder="Nom">
|
|
<label class="admin-checkbox-label admin-jury-ext">
|
|
<input type="checkbox" name="jury_lecteurs_ext[<?= $li ?>]" value="1"
|
|
<?= $lm['is_external'] ? 'checked' : '' ?>> Externe
|
|
</label>
|
|
<button type="button" class="admin-btn-remove" onclick="removeJuryRow(this)"
|
|
aria-label="Supprimer ce lecteur"><span aria-hidden="true">✕</span></button>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
<button type="button" class="admin-btn-secondary admin-add-jury-btn"
|
|
onclick="addJuryRow()">+ Ajouter un·e lecteur·ice</button>
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
<script>
|
|
var juryIdx = <?= $juryIdx ?>;
|
|
function addJuryRow() {
|
|
var list = document.getElementById('jury-lecteurs-list');
|
|
var div = document.createElement('div');
|
|
div.className = 'admin-jury-entry';
|
|
div.innerHTML = '<input type="text" name="jury_lecteurs[]" placeholder="Nom">'
|
|
+ '<label class="admin-checkbox-label admin-jury-ext">'
|
|
+ '<input type="checkbox" name="jury_lecteurs_ext[' + juryIdx + ']" value="1"> Externe'
|
|
+ '</label>'
|
|
+ '<button type="button" class="admin-btn-remove" onclick="removeJuryRow(this)" aria-label="Supprimer ce lecteur"><span aria-hidden="true">✕</span></button>';
|
|
list.appendChild(div);
|
|
juryIdx++;
|
|
}
|
|
function removeJuryRow(btn) {
|
|
btn.closest('.admin-jury-entry').remove();
|
|
}
|
|
</script>
|