acces.php: remove Mot de passe column, add key icon copy button, reorder actions, switch URL icon to link-simple; fix dialog functions not on window; fix archive: move form into dialog (native submit); add caret icon to archived links details

This commit is contained in:
Pontoporeia
2026-07-05 12:05:53 +02:00
parent 3e93150c76
commit 3c845f9d40
6 changed files with 39 additions and 51 deletions
+1
View File
@@ -19,3 +19,4 @@
- [x] Move cleanup UI from modal to dedicated page (like add.php/edit.php)
- [x] Replace <details> with <fieldset>/<legend> in cleanup fragments (like contenus.php)
- [x] Standardise test group recipes: lint-php, lint-css, lint-js, test + add fix recipe + make lint pass clean
- [x] Remove Mot de passe column from acces.php, add key.svg icon button in Actions to copy password to clipboard, reorder actions (URL/password/edit/toggle/archive), switch URL icon to link-simple.svg
+8 -4
View File
@@ -1157,7 +1157,8 @@ th.admin-ap-col {
/* <details>/<summary> inside cleanup sections */
.n-grid > details > summary,
.n-section > summary {
.n-section > summary,
.admin-archived-links > summary {
cursor: pointer;
font-weight: 600;
font-size: var(--step--1);
@@ -1170,7 +1171,8 @@ th.admin-ap-col {
gap: var(--space-2xs);
}
.n-grid > details > summary::-webkit-details-marker,
.n-section > summary::-webkit-details-marker {
.n-section > summary::-webkit-details-marker,
.admin-archived-links > summary::-webkit-details-marker {
display: none;
}
.n-section[open],
@@ -1184,7 +1186,8 @@ th.admin-ap-col {
}
.n-grid > details > summary::before,
.n-section > summary::before {
.n-section > summary::before,
.admin-archived-links > summary::before {
content: "";
display: inline-block;
width: 16px;
@@ -1198,7 +1201,8 @@ th.admin-ap-col {
transition: transform 0.15s;
}
.n-grid > details[open] > summary::before,
.n-section[open] > summary::before {
.n-section[open] > summary::before,
.admin-archived-links[open] > summary::before {
transform: rotate(90deg);
}
.n-grid > details > :not(summary),
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M216.57,39.43A80,80,0,0,0,83.91,120.78L28.69,176A15.86,15.86,0,0,0,24,187.31V216a16,16,0,0,0,16,16H72a8,8,0,0,0,8-8V208H96a8,8,0,0,0,8-8V184h16a8,8,0,0,0,5.66-2.34l9.56-9.57A79.73,79.73,0,0,0,160,176h.1A80,80,0,0,0,216.57,39.43ZM224,98.1c-1.09,34.09-29.75,61.86-63.89,61.9H160a63.7,63.7,0,0,1-23.65-4.51,8,8,0,0,0-8.84,1.68L116.69,168H96a8,8,0,0,0-8,8v16H72a8,8,0,0,0-8,8v16H40V187.31l58.83-58.82a8,8,0,0,0,1.68-8.84A63.72,63.72,0,0,1,96,95.92c0-34.14,27.81-62.8,61.9-63.89A64,64,0,0,1,224,98.1ZM192,76a12,12,0,1,1-12-12A12,12,0,0,1,192,76Z"></path></svg>

After

Width:  |  Height:  |  Size: 664 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M165.66,90.34a8,8,0,0,1,0,11.32l-64,64a8,8,0,0,1-11.32-11.32l64-64A8,8,0,0,1,165.66,90.34ZM215.6,40.4a56,56,0,0,0-79.2,0L106.34,70.45a8,8,0,0,0,11.32,11.32l30.06-30a40,40,0,0,1,56.57,56.56l-30.07,30.06a8,8,0,0,0,11.31,11.32L215.6,119.6a56,56,0,0,0,0-79.2ZM138.34,174.22l-30.06,30.06a40,40,0,1,1-56.56-56.57l30.05-30.05a8,8,0,0,0-11.32-11.32L40.4,136.4a56,56,0,0,0,79.2,79.2l30.06-30.07a8,8,0,0,0-11.32-11.31Z"></path></svg>

After

Width:  |  Height:  |  Size: 532 B

+6 -15
View File
@@ -74,38 +74,29 @@ function _copyTextToClipboard(text) {
.catch(() => {});
}
function _openEditDialog(id, name, _hasPassword, expiresVal) {
window.openEditDialog = function (id, name, _hasPassword, expiresVal) {
document.getElementById("edit-link-id").value = id;
document.getElementById("edit-name").value = name || "";
document.getElementById("edit-expires").value = expiresVal || "";
document.getElementById("edit-dialog").showModal();
}
function _openApproveDialog(requestId) {
window.openApproveDialog = function (requestId) {
document.getElementById("approve-request-id").value = requestId;
document.getElementById("approve-dialog").showModal();
}
function _openRejectDialog(requestId) {
window.openRejectDialog = function (requestId) {
document.getElementById("reject-request-id").value = requestId;
document.getElementById("reject-dialog").showModal();
}
var _pendingArchiveLinkId = null;
function _openArchiveLinkDialog(id) {
_pendingArchiveLinkId = id;
window.openArchiveLinkDialog = function (id) {
document.getElementById("archive-link-id").value = id;
document.getElementById("archive-link-dialog").showModal();
}
function _executeArchiveLink() {
var form = document.getElementById(
`archive-link-form-${_pendingArchiveLinkId}`,
);
if (form) form.submit();
}
function _openDeleteArchivedLinkDialog(id) {
window.openDeleteArchivedLinkDialog = function (id) {
document.getElementById("delete-archived-link-id").value = id;
document.getElementById("delete-archived-link-dialog").showModal();
}
+19 -29
View File
@@ -28,7 +28,6 @@
<th scope="col">Objet</th>
<th scope="col">Année</th>
<th scope="col">Statut</th>
<th scope="col">Mot de passe</th>
<th scope="col">Utilisations</th>
<th scope="col">Expiration</th>
<th scope="col">Créé le</th>
@@ -78,34 +77,26 @@
<span style="display:inline-block;padding:var(--space-3xs) var(--space-2xs);border-radius:3px;font-size:var(--step--2);font-weight:500;letter-spacing:0.04em;background:var(--error-muted-bg);color:var(--error);"><?= $statusLabel ?></span>
<?php endif; ?>
</td>
<td>
<?php if ($hasLinkPassword): ?>
<div style="display:flex;align-items:center;gap:var(--space-2xs);">
<span>Oui</span>
<input type="hidden" id="pwd-<?= $link['id'] ?>" value="<?= htmlspecialchars($link['_decrypted_password'] ?? '') ?>">
<button type="button" class="admin-icon-btn" title="Copier le mot de passe"
onclick="event.stopPropagation(); copyTextToClipboard(document.getElementById('pwd-<?= $link['id'] ?>').value)"
style="width:24px;height:24px;">
<?= icon('copy-duplicate') ?>
</button>
</div>
<?php else: ?>
Non
<?php endif; ?>
</td>
<td style="text-align:center;"><?= intval($link['usage_count']) ?></td>
<td><?= $expires ?></td>
<td><?= $created ?></td>
<td class="admin-actions-col">
<div class="admin-actions">
<button type="button" class="admin-icon-btn admin-icon-btn--copy" title="Copier l'URL"
onclick="event.stopPropagation(); copyUrl(<?= $link['id'] ?>)">
<?= icon('link-simple') ?>
</button>
<?php if ($hasLinkPassword): ?>
<input type="hidden" id="pwd-<?= $link['id'] ?>" value="<?= htmlspecialchars($link['_decrypted_password'] ?? '') ?>">
<button type="button" class="admin-icon-btn admin-icon-btn--key" title="Copier le mot de passe"
onclick="event.stopPropagation(); copyTextToClipboard(document.getElementById('pwd-<?= $link['id'] ?>').value)">
<?= icon('key') ?>
</button>
<?php endif; ?>
<button type="button" class="admin-icon-btn admin-icon-btn--edit" title="Éditer"
onclick="event.stopPropagation(); openEditDialog(<?= $link['id'] ?>, <?= htmlspecialchars(json_encode($linkName), ENT_QUOTES) ?>, <?= $hasLinkPassword ? 'true' : 'false' ?>, <?= htmlspecialchars(json_encode($linkExpiresVal), ENT_QUOTES) ?>)">
<?= icon('pencil-note') ?>
</button>
<button type="button" class="admin-icon-btn admin-icon-btn--copy" title="Copier l'URL"
onclick="event.stopPropagation(); copyUrl(<?= $link['id'] ?>)">
<?= icon('copy-duplicate') ?>
</button>
<form method="post" action="actions/acces-etudiante.php" class="publish-form" onclick="event.stopPropagation()">
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>">
<input type="hidden" name="action" value="toggle">
@@ -120,16 +111,10 @@
<?php endif; ?>
</button>
</form>
<form method="post" action="actions/acces-etudiante.php" class="publish-form"
id="archive-link-form-<?= $link['id'] ?>" onclick="event.stopPropagation()">
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>">
<input type="hidden" name="action" value="archive">
<input type="hidden" name="id" value="<?= $link['id'] ?>">
<button type="button" class="admin-icon-btn admin-icon-btn--archive" title="Archiver"
onclick="openArchiveLinkDialog(<?= $link['id'] ?>)">
onclick="event.stopPropagation(); openArchiveLinkDialog(<?= $link['id'] ?>)">
<?= icon('monitor') ?>
</button>
</form>
</div>
</td>
</tr>
@@ -139,7 +124,7 @@
<?php endif; ?>
<?php if (!empty($archivedLinks)): ?>
<details style="margin-top:var(--space-m);">
<details class="admin-archived-links" style="margin-top:var(--space-m);">
<summary style="cursor:pointer;font-weight:600;color:var(--text-secondary);font-size:var(--step--1);">
Liens archivés (<?= count($archivedLinks) ?>)
</summary>
@@ -599,7 +584,12 @@
<p>Archiver ce lien ? Il ne sera plus accessible, mais les statistiques seront conservées.</p>
</div>
<div class="admin-dialog__footer">
<button type="button" class="btn btn--warning" onclick="this.closest('dialog').close(); _executeArchiveLink()">Archiver</button>
<form method="post" action="actions/acces-etudiante.php">
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>">
<input type="hidden" name="action" value="archive">
<input type="hidden" name="id" id="archive-link-id" value="">
<button type="submit" class="btn btn--warning">Archiver</button>
</form>
<button type="button" class="btn btn--secondary" onclick="this.closest('dialog').close()">Annuler</button>
</div>
</dialog>