Separate admin views from controllers — move HTML to templates/admin/

All admin pages refactored to thin controllers + pure view templates, mirroring
the public-page pattern:

Controllers (public/admin/*.php): auth, data loading, include template
Views (templates/admin/*.php): pure HTML/PHP output
Fragment partials (templates/admin/partials/): toast, system-log-panel, system-nginx-config-panel

Pages migrated: login, tags, contenus, contenus-edit, account, acces-etudiante,
thanks, add, edit, parametres, system, index

Fragment endpoints refactored: system-fragment.php, toast-fragment.php
Skipped (pure redirects): logout, logs, status, import
This commit is contained in:
Pontoporeia
2026-04-21 21:49:30 +02:00
parent 362688c0fa
commit 4839b568de
34 changed files with 1886 additions and 2089 deletions

View File

@@ -1,5 +1,11 @@
<!-- Fixed toast container (bottom-center, always visible) -->
<div id="toast-container" aria-live="polite"></div>
<!-- Toast region polled by HTMX after page load -->
<aside id="toast-region"
aria-live="polite"
hx-get="/admin/toast-fragment.php"
hx-trigger="load"
hx-swap="innerHTML"
hx-target="#toast-region">
</aside>
<?php foreach ($extraJs ?? [] as $js): ?>
<script src="<?= App::assetV($js) ?>"></script>
@@ -8,30 +14,5 @@
<script><?= $extraJsInline ?></script>
<?php endif; ?>
<script src="/assets/js/htmx.min.js"></script>
<script>
(function () {
var box = document.getElementById('toast-container');
if (!box) return;
// 1) Flash messages from hidden #admin-toasts
var src = document.getElementById('admin-toasts');
if (src) {
src.querySelectorAll('.toast').forEach(function (t) { box.appendChild(t); });
src.remove();
}
// 2) Orphaned .toast elements rendered inline by pages (login, thanks, etc.)
document.querySelectorAll('.toast:not(#toast-container .toast)')
.forEach(function (t) { box.appendChild(t); });
// Auto-dismiss every toast after 4 seconds
box.querySelectorAll('.toast').forEach(function (toast, i) {
setTimeout(function () {
toast.classList.add('toast-exit');
toast.addEventListener('animationend', function () { toast.remove(); });
}, 4000 + (i * 200));
});
})();
</script>
</body>
</html>