Refactor HTMX fragment architecture: DRY split into auth endpoints + shared templates

- Created templates/partials/form/_licence.php (shared HTML, no auth logic)
- Created templates/partials/form/_format-website.php (shared HTML, no auth logic)
- Created src/FragmentRenderer.php helper for clean fragment rendering
- Created public/{admin,partage}/fragments/ subdirectories
- Created thin fragment endpoint files: auth guard + data fetch + render template
- Updated all hx-post references in templates to new fragments/ paths
- Updated partage/index.php routing for new fragments subdirectory
- Kept old fragment files as thin delegates for backward compat
- Updated nginx config: added PHP handler in /partage/ location block
This commit is contained in:
Pontoporeia
2026-05-12 15:01:17 +02:00
parent 2632730fa0
commit da153fc604
38 changed files with 503 additions and 527 deletions

View File

@@ -1,17 +1,6 @@
<?php
/**
* fichiers-fragment.php (admin)
*
* Admin-gated HTMX fragment: returns the combined Format(s) + Fichiers block
* for the admin add/edit forms. Wraps the shared logic in fichiers-fragment.php
* after enforcing authentication.
* Admin fragment: Format(s) + Fichiers block (HTMX partial).
* @deprecated Use /admin/fragments/fichiers.php instead.
*/
require_once __DIR__ . '/../../bootstrap.php';
require_once __DIR__ . '/../../src/AdminAuth.php';
App::boot();
AdminAuth::requireLogin();
$_POST['admin_mode'] = '1';
require_once APP_ROOT . '/templates/partials/form/fichiers-fragment.php';
require_once __DIR__ . '/fragments/fichiers.php';