forked from fa/breadcrumb-the-shire
refactor(settings/audit): conditional retention disclosure + flat layout
Drops the wrapping details-card so the audit toggle and retention input read like the email page. The audit switch now uses role="switch" and a new app-settings-audit component (built on the existing createConditionalToggleInit primitive) hides the retention block when audit is disabled — the input is meaningless without audit on, and the control state syncs automatically on toggle. The redundant info blockquote and the toggle's paraphrased DB description are gone. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -46,37 +46,26 @@ $disabledAttr = $isReadOnly ? 'disabled' : '';
|
||||
require templatePath('partials/app-details-titlebar.phtml');
|
||||
?>
|
||||
|
||||
<form id="settings-audit-form" method="post" data-details-storage="settings-audit-details-v1" data-standard-detail-form="1">
|
||||
<details class="app-details-card" name="settings-audit-system" data-details-key="settings-audit-system" open>
|
||||
<summary>
|
||||
<span class="app-details-card-summary-title"><?php e(t('System audit')); ?></span>
|
||||
<span class="app-details-card-summary-meta">
|
||||
<span class="badge" data-variant="neutral"><?php e($systemAuditEnabled ? t('Enabled') : t('Disabled')); ?></span>
|
||||
</span>
|
||||
</summary>
|
||||
<div class="app-details-card-container">
|
||||
<blockquote data-variant="info">
|
||||
<small><?php e(t('System audit controls whether security events are logged and how long they are kept.')); ?></small>
|
||||
</blockquote>
|
||||
<label class="app-field">
|
||||
<input type="checkbox" name="system_audit_enabled" value="1" <?php e($systemAuditEnabled ? 'checked' : ''); ?> <?php e($disabledAttr); ?>>
|
||||
<span><?php e(t('Enable system audit log')); ?></span>
|
||||
</label>
|
||||
<form id="settings-audit-form" method="post" data-standard-detail-form="1">
|
||||
<div data-settings-audit-root>
|
||||
<label class="app-field">
|
||||
<input type="checkbox" role="switch" name="system_audit_enabled" value="1"
|
||||
data-audit-enabled-toggle
|
||||
<?php e($systemAuditEnabled ? 'checked' : ''); ?> <?php e($disabledAttr); ?>>
|
||||
<span><?php e(t('Enable system audit log')); ?></span>
|
||||
</label>
|
||||
<div data-audit-when-enabled <?php e($systemAuditEnabled ? '' : 'hidden'); ?>>
|
||||
<hr>
|
||||
<label class="app-field">
|
||||
<span><?php e(t('Retention (days)')); ?></span>
|
||||
<input
|
||||
type="number"
|
||||
name="system_audit_retention_days"
|
||||
<input type="number" name="system_audit_retention_days"
|
||||
value="<?php e((string) $systemAuditRetentionDays); ?>"
|
||||
min="30"
|
||||
max="1095"
|
||||
step="1"
|
||||
min="30" max="1095" step="1"
|
||||
<?php e($readonlyAttr); ?>>
|
||||
<small><?php e(t($systemAuditRetentionDaysDesc)); ?></small>
|
||||
</label>
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
|
||||
<?php Session::getCsrfInput(); ?>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user