feat : recherche titre, toggle à la une, date modif, retour sources (v1.6.15)
- admin/articles : champ filter_search (titre, insensible casse) cumulable avec auteur/catégorie/statut (#85) - admin/articles : colonne ★ avec toggle rapide featured + filtre filter_featured (#84) - post/ : date de modification sous la date de publication si modifié après mise en ligne (#81) - sources/ : bouton ← Retour à l'article vers post/<slug> au lieu de /edit/<uuid> (#83) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+30
-1
@@ -214,6 +214,8 @@ function adminStatusBadge(array $a, int $now): string
|
||||
'filter_author' => $adminData['filter_author'] ?? '',
|
||||
'filter_category' => $adminData['filter_category'] ?? '',
|
||||
'filter_status' => $adminData['filter_status'] ?? '',
|
||||
'filter_search' => $adminData['filter_search'] ?? '',
|
||||
'filter_featured' => $adminData['filter_featured'] ?? '',
|
||||
], fn ($v) => $v !== '');
|
||||
$p['sort'] = $col;
|
||||
$p['dir'] = $dir;
|
||||
@@ -263,9 +265,19 @@ function adminStatusBadge(array $a, int $now): string
|
||||
<option value="preview" <?= ($adminData['filter_status'] ?? '') === 'preview' ? 'selected' : '' ?>>Avant-première</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<select name="filter_featured" class="form-select form-select-sm">
|
||||
<option value="">Tous</option>
|
||||
<option value="yes" <?= ($adminData['filter_featured'] ?? '') === 'yes' ? 'selected' : '' ?>>★ À la une</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<input type="text" name="filter_search" class="form-control form-control-sm"
|
||||
placeholder="Rechercher…" value="<?= htmlspecialchars($adminData['filter_search'] ?? '') ?>">
|
||||
</div>
|
||||
<div class="col-auto d-flex gap-2">
|
||||
<button type="submit" class="btn btn-secondary btn-sm">Filtrer</button>
|
||||
<?php $hasFilter = ($adminData['filter_author'] ?? '') !== '' || ($adminData['filter_category'] ?? '') !== '' || ($adminData['filter_status'] ?? '') !== ''; ?>
|
||||
<?php $hasFilter = ($adminData['filter_author'] ?? '') !== '' || ($adminData['filter_category'] ?? '') !== '' || ($adminData['filter_status'] ?? '') !== '' || ($adminData['filter_search'] ?? '') !== '' || ($adminData['filter_featured'] ?? '') !== ''; ?>
|
||||
<?php if ($hasFilter): ?>
|
||||
<a href="/admin/articles" class="btn btn-link btn-sm p-0">Réinitialiser</a>
|
||||
<?php endif; ?>
|
||||
@@ -304,6 +316,7 @@ function adminStatusBadge(array $a, int $now): string
|
||||
<?php if (isAdmin()): ?><th>Auteur</th><?php endif; ?>
|
||||
<th>Catégorie</th>
|
||||
<th>Statut</th>
|
||||
<th title="À la une">★</th>
|
||||
<th>
|
||||
<a href="<?= htmlspecialchars($_mkSortUrl('published')) ?>"
|
||||
class="text-decoration-none text-reset">
|
||||
@@ -330,6 +343,22 @@ function adminStatusBadge(array $a, int $now): string
|
||||
<?php endif; ?>
|
||||
<td class="text-muted small"><?= htmlspecialchars($a['category'] ?? '–') ?></td>
|
||||
<td><?= adminStatusBadge($a, $now) ?></td>
|
||||
<td class="text-center">
|
||||
<?php if (isAdmin()): ?>
|
||||
<?php $_isFeatured = !empty($a['featured']); ?>
|
||||
<?php $_backUrl = '/admin/articles?' . http_build_query(array_filter(['filter_author' => $adminData['filter_author'] ?? '', 'filter_category' => $adminData['filter_category'] ?? '', 'filter_status' => $adminData['filter_status'] ?? '', 'filter_search' => $adminData['filter_search'] ?? '', 'filter_featured' => $adminData['filter_featured'] ?? '', 'sort' => $_sortBy, 'dir' => $_sortDir], fn ($v) => $v !== '')); ?>
|
||||
<form method="post" action="/?action=admin_toggle_featured" class="d-inline m-0">
|
||||
<input type="hidden" name="uuid" value="<?= htmlspecialchars($a['uuid']) ?>">
|
||||
<input type="hidden" name="_back" value="<?= htmlspecialchars($_backUrl) ?>">
|
||||
<button type="submit" class="btn btn-link p-0 border-0 lh-1 fs-6"
|
||||
title="<?= $_isFeatured ? 'Retirer de la une' : 'Mettre à la une' ?>">
|
||||
<?= $_isFeatured ? '★' : '<span class="text-muted">☆</span>' ?>
|
||||
</button>
|
||||
</form>
|
||||
<?php else: ?>
|
||||
<?= !empty($a['featured']) ? '★' : '' ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="text-muted small text-nowrap">
|
||||
<?= htmlspecialchars(date('d/m/Y', strtotime((string)($a['published_at'] ?? $a['created_at'] ?? '')))) ?>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user