mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
feat(admin): add htmx toast feedback for settings checkboxes in contenus.php
- Replace hx-swap="none" with hx-target on response divs inside each of the three fieldsets (Restrictions d'accès, Degré d'ouverture, Types de travaux) - Add hxToastSuccess / hxToastError helpers in settings.php that return HTML toast fragments with self-referencing auto-dismiss after 3s - Each response div has aria-live="polite" for accessibility - Add comprehensive PHP/JS debugging logs: - settings.php logs raw POST values per field before resolving to 0/1 - checkboxes have hx-on::before-request and hx-on::after-request console.log - global htmx:beforeSend and htmx:sendError listeners in admin footer - toast lifecycle logged (creation + removal) for traceability - Fix toast auto-remove: use getElementById with random unique ID instead of querySelector which could remove wrong toast on rapid clicks - Follows the Django+HTMX ajax checkbox pattern from the reference tutorial feat(admin): add htmx toast feedback for settings checkboxes in contenus.php - Replace hx-swap="none" with hx-target on response divs inside each of the three fieldsets (Restrictions d'accès, Degré d'ouverture, Types de travaux) - Add hxToastSuccess / hxToastError helpers in settings.php that return HTML toast fragments with self-referencing auto-dismiss after 3s - Each response div has aria-live="polite" for accessibility - Add comprehensive PHP/JS debugging logs: - settings.php logs raw POST values per field before resolving to 0/1 - checkboxes have hx-on::before-request and hx-on::after-request console.log - global htmx:beforeSend and htmx:sendError listeners in admin footer - toast lifecycle logged (creation + removal) for traceability - Fix toast auto-remove: use getElementById with random unique ID instead of querySelector which could remove wrong toast on rapid clicks - Fix checkbox unresponsive after toggles: move hidden value="0" inputs outside <label> to prevent HTML label double-activation - Follows the Django+HTMX ajax checkbox pattern from the reference tutorial feat(admin): add htmx toast feedback for settings checkboxes in contenus.php - Replace hx-swap="none" with hx-target on response divs inside each of the three fieldsets (Restrictions d'accès, Degré d'ouverture, Types de travaux) - Add hxToastSuccess / hxToastError helpers in settings.php that return HTML toast fragments with self-referencing auto-dismiss after 3s - Each response div has aria-live="polite" for accessibility - Add comprehensive PHP/JS debugging logs: - settings.php logs raw POST values per field before resolving to 0/1 - checkboxes have hx-on::before-request and hx-on::after-request console.log - global htmx:beforeSend and htmx:sendError listeners in admin footer - toast lifecycle logged (creation + removal) for traceability - Fix toast auto-remove: use getElementById with random unique ID instead of querySelector which could remove wrong toast on rapid clicks - Fix checkbox unresponsive after toggles: remove hidden value="0" inputs entirely; unchecked checkboxes are simply absent from POST and server treats missing key as 0 outside <label> to prevent HTML label double-activation - Follows the Django+HTMX ajax checkbox pattern from the reference tutorial
This commit is contained in:
@@ -727,6 +727,19 @@
|
||||
+%%%%%%% diff from: somsyvxz 249f7943 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebased revision)
|
||||
+\\\\\\\ to: sstzwlpk 0e83e8f7 "feat(deploy): upload deploy-server.sh, run migrations, fix migrate.sh server layout" (rebased revision)
|
||||
++ $linkName = $link['name'] ?? '';
|
||||
++ $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : '';
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff from: sstzwlpk 0e83e8f7 "feat(deploy): upload deploy-server.sh, run migrations, fix migrate.sh server layout" (rebased revision)
|
||||
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ to: somsyvxz 249f7943 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebased revision)
|
||||
- $linkName = $link['name'] ?? '';
|
||||
- $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : '';
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff from: somsyvxz 14a3cd10 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebase destination)
|
||||
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ to: rxpvwzkt 8a49f872 "feat(admin): add htmx toast feedback for settings checkboxes in contenus.php" (rebased revision)
|
||||
$linkName = $link['name'] ?? '';
|
||||
$linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : '';
|
||||
$linkLockedYear = $link['locked_year'] ?? null;
|
||||
+%%%%%%% diff from: somsyvxz 249f7943 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebased revision)
|
||||
+\\\\\\\ to: rxpvwzkt 7fac18bc "feat(admin): add htmx toast feedback for settings checkboxes in contenus.php" (rebased revision)
|
||||
++ $linkName = $link['name'] ?? '';
|
||||
++ $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : '';
|
||||
?>
|
||||
<tr class="admin-table-row" onclick="event.stopPropagation(); window.open('/partage/<?= urlencode($link['slug']) ?>', '_blank')" style="cursor:pointer">
|
||||
|
||||
@@ -93,12 +93,12 @@
|
||||
<input type="hidden" name="section" value="formulaire_restrictions">
|
||||
|
||||
<label class="param-checkbox">
|
||||
<input type="hidden" name="restricted_files_enabled" value="0">
|
||||
<input type="checkbox" name="restricted_files_enabled" value="1"
|
||||
<?= ($siteSettings['restricted_files_enabled'] ?? '0') === '1' ? 'checked' : '' ?>
|
||||
hx-post="/admin/actions/settings.php"
|
||||
hx-trigger="change"
|
||||
hx-swap="none"
|
||||
hx-target="#restrictions-response"
|
||||
hx-swap="innerHTML"
|
||||
hx-include="#fieldset-restrictions">
|
||||
<span>
|
||||
<strong>Activer la restriction d'accès</strong><br>
|
||||
@@ -106,6 +106,8 @@
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div id="restrictions-response" aria-live="polite"></div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="fieldset-acces">
|
||||
@@ -117,12 +119,12 @@
|
||||
<input type="hidden" name="section" value="formulaire_acces">
|
||||
|
||||
<label class="param-checkbox">
|
||||
<input type="hidden" name="access_type_libre_enabled" value="0">
|
||||
<input type="checkbox" name="access_type_libre_enabled" value="1"
|
||||
<?= ($siteSettings['access_type_libre_enabled'] ?? '0') === '1' ? 'checked' : '' ?>
|
||||
hx-post="/admin/actions/settings.php"
|
||||
hx-trigger="change"
|
||||
hx-swap="none"
|
||||
hx-target="#acces-response"
|
||||
hx-swap="innerHTML"
|
||||
hx-include="#fieldset-acces">
|
||||
<span>
|
||||
<strong>Libre</strong><br>
|
||||
@@ -131,12 +133,12 @@
|
||||
</label>
|
||||
|
||||
<label class="param-checkbox">
|
||||
<input type="hidden" name="access_type_interne_enabled" value="0">
|
||||
<input type="checkbox" name="access_type_interne_enabled" value="1"
|
||||
<?= ($siteSettings['access_type_interne_enabled'] ?? '1') === '1' ? 'checked' : '' ?>
|
||||
hx-post="/admin/actions/settings.php"
|
||||
hx-trigger="change"
|
||||
hx-swap="none"
|
||||
hx-target="#acces-response"
|
||||
hx-swap="innerHTML"
|
||||
hx-include="#fieldset-acces">
|
||||
<span>
|
||||
<strong>Interne</strong><br>
|
||||
@@ -145,12 +147,12 @@
|
||||
</label>
|
||||
|
||||
<label class="param-checkbox">
|
||||
<input type="hidden" name="access_type_interdit_enabled" value="0">
|
||||
<input type="checkbox" name="access_type_interdit_enabled" value="1"
|
||||
<?= ($siteSettings['access_type_interdit_enabled'] ?? '1') === '1' ? 'checked' : '' ?>
|
||||
hx-post="/admin/actions/settings.php"
|
||||
hx-trigger="change"
|
||||
hx-swap="none"
|
||||
hx-target="#acces-response"
|
||||
hx-swap="innerHTML"
|
||||
hx-include="#fieldset-acces">
|
||||
<span>
|
||||
<strong>Interdit</strong><br>
|
||||
@@ -158,6 +160,8 @@
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div id="acces-response" aria-live="polite"></div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="fieldset-types">
|
||||
@@ -178,12 +182,12 @@
|
||||
</label>
|
||||
|
||||
<label class="param-checkbox">
|
||||
<input type="hidden" name="objet_these_enabled" value="0">
|
||||
<input type="checkbox" name="objet_these_enabled" value="1"
|
||||
<?= ($siteSettings['objet_these_enabled'] ?? '1') === '1' ? 'checked' : '' ?>
|
||||
hx-post="/admin/actions/settings.php"
|
||||
hx-trigger="change"
|
||||
hx-swap="none"
|
||||
hx-target="#types-response"
|
||||
hx-swap="innerHTML"
|
||||
hx-include="#fieldset-types">
|
||||
<span>
|
||||
<strong>Thèse</strong><br>
|
||||
@@ -192,12 +196,12 @@
|
||||
</label>
|
||||
|
||||
<label class="param-checkbox">
|
||||
<input type="hidden" name="objet_frart_enabled" value="0">
|
||||
<input type="checkbox" name="objet_frart_enabled" value="1"
|
||||
<?= ($siteSettings['objet_frart_enabled'] ?? '1') === '1' ? 'checked' : '' ?>
|
||||
hx-post="/admin/actions/settings.php"
|
||||
hx-trigger="change"
|
||||
hx-swap="none"
|
||||
hx-target="#types-response"
|
||||
hx-swap="innerHTML"
|
||||
hx-include="#fieldset-types">
|
||||
<span>
|
||||
<strong>Frart</strong><br>
|
||||
@@ -205,6 +209,8 @@
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div id="types-response" aria-live="polite"></div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
|
||||
Reference in New Issue
Block a user