mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
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:
@@ -42,7 +42,7 @@ $adminMode = $adminMode ?? false;
|
||||
<div class="licence-degree">
|
||||
<label class="admin-checkbox-label">
|
||||
<input type="radio" name="access_type_id" value=""
|
||||
hx-post="/admin/licence-fragment.php"
|
||||
hx-post="/admin/fragments/licence.php"
|
||||
hx-target=".licence-license-choice"
|
||||
hx-swap="outerHTML"
|
||||
hx-include="closest fieldset"
|
||||
@@ -56,7 +56,7 @@ $adminMode = $adminMode ?? false;
|
||||
<div class="licence-degree">
|
||||
<label class="admin-checkbox-label">
|
||||
<input type="radio" name="access_type_id" value="1"
|
||||
hx-post="<?= $adminMode ? '/admin/licence-fragment.php' : '/partage/licence-fragment' ?>"
|
||||
hx-post="<?= $adminMode ? '/admin/fragments/licence.php' : '/partage/fragments/licence.php' ?>"
|
||||
hx-target=".licence-license-choice"
|
||||
hx-swap="outerHTML"
|
||||
hx-include="closest fieldset"
|
||||
@@ -77,7 +77,7 @@ $adminMode = $adminMode ?? false;
|
||||
<div class="licence-degree">
|
||||
<label class="admin-checkbox-label">
|
||||
<input type="radio" name="access_type_id" value="2"
|
||||
hx-post="<?= $adminMode ? '/admin/licence-fragment.php' : '/partage/licence-fragment' ?>"
|
||||
hx-post="<?= $adminMode ? '/admin/fragments/licence.php' : '/partage/fragments/licence.php' ?>"
|
||||
hx-target=".licence-license-choice"
|
||||
hx-swap="outerHTML"
|
||||
hx-include="closest fieldset"
|
||||
@@ -99,7 +99,7 @@ $adminMode = $adminMode ?? false;
|
||||
<div class="licence-degree">
|
||||
<label class="admin-checkbox-label">
|
||||
<input type="radio" name="access_type_id" value="3"
|
||||
hx-post="<?= $adminMode ? '/admin/licence-fragment.php' : '/partage/licence-fragment' ?>"
|
||||
hx-post="<?= $adminMode ? '/admin/fragments/licence.php' : '/partage/fragments/licence.php' ?>"
|
||||
hx-target=".licence-license-choice"
|
||||
hx-swap="outerHTML"
|
||||
hx-include="closest fieldset"
|
||||
@@ -121,7 +121,7 @@ $adminMode = $adminMode ?? false;
|
||||
|
||||
<!-- Licence — swapped via htmx when radio changes -->
|
||||
<div class="licence-license-choice"
|
||||
hx-post="<?= $adminMode ? '/admin/licence-fragment.php' : '/partage/licence-fragment' ?>"
|
||||
hx-post="<?= $adminMode ? '/admin/fragments/licence.php' : '/partage/fragments/licence.php' ?>"
|
||||
hx-trigger="load"
|
||||
hx-include="closest fieldset"
|
||||
hx-swap="outerHTML">
|
||||
|
||||
Reference in New Issue
Block a user