search: ajout filtres finalité et format, boutons plus compacts et Réinitialiser en neutre

This commit is contained in:
Pontoporeia
2026-06-09 13:20:26 +02:00
parent 34739d6ae5
commit 07370b7221
4 changed files with 43 additions and 17 deletions

View File

@@ -10,4 +10,6 @@
- [x] Fix #7: Options de licence non persistées en edit — HTMX load trigger perdait les valeurs - [x] Fix #7: Options de licence non persistées en edit — HTMX load trigger perdait les valeurs
- [x] Fix #3 (v2): findOrCreateAuthor avec cascade ID → nom → email, setThesisAuthors passe les IDs existants - [x] Fix #3 (v2): findOrCreateAuthor avec cascade ID → nom → email, setThesisAuthors passe les IDs existants
- [x] Migration 038: corriger les identifiers theses qui ne matchent pas leur année - [x] Migration 038: corriger les identifiers theses qui ne matchent pas leur année
- [x] Filtres finalité + format dans la page de recherche (search.php)
- [x] Styliser boutons Filtrer/Réinitialiser : plus compacts, Réinitialiser en neutre
- [ ] Commit + jj new - [ ] Commit + jj new

View File

@@ -250,7 +250,7 @@
display: flex; display: flex;
align-items: center; align-items: center;
gap: var(--space-s); gap: var(--space-s);
padding: var(--space-3xs) var(--space-m); padding: var(--space-xs) var(--space-m);
border-bottom: 1px solid var(--border-secondary); border-bottom: 1px solid var(--border-secondary);
flex-shrink: 0; flex-shrink: 0;
flex-wrap: wrap; flex-wrap: wrap;
@@ -278,21 +278,9 @@
border: 2px solid var(--accent-primary); border: 2px solid var(--accent-primary);
} }
.search-apply-btn { .search-apply-btn,
/* deprecated alias for .btn--primary; kept for backward-compat */
}
.search-reset-link { .search-reset-link {
font-size: var(--step--1); /* btn--sm classes handle styling; space kept for potential overrides */
color: var(--text-secondary);
text-decoration: none;
font-weight: 400;
cursor: pointer;
transition: color 0.15s;
}
.search-reset-link:hover {
color: var(--accent-primary);
} }
/* Search results pagination */ /* Search results pagination */

View File

@@ -87,6 +87,8 @@ class SearchController
$years = []; $years = [];
$orientations = []; $orientations = [];
$apPrograms = []; $apPrograms = [];
$finalityTypes = [];
$formatTypes = [];
$coverMap = []; $coverMap = [];
try { try {
@@ -100,6 +102,8 @@ class SearchController
$years = $this->db->getAvailableYears(); $years = $this->db->getAvailableYears();
$orientations = $this->db->getAllOrientations(); $orientations = $this->db->getAllOrientations();
$apPrograms = $this->db->getAllAPPrograms(); $apPrograms = $this->db->getAllAPPrograms();
$finalityTypes = $this->db->getAllFinalityTypes();
$formatTypes = $this->db->getAllFormatTypes();
if (!empty($results)) { if (!empty($results)) {
$coverMap = $this->db->getCoverPathsForTheses(array_column($results, 'id')); $coverMap = $this->db->getCoverPathsForTheses(array_column($results, 'id'));
} }
@@ -129,6 +133,8 @@ class SearchController
'years' => $years, 'years' => $years,
'orientations' => $orientations, 'orientations' => $orientations,
'apPrograms' => $apPrograms, 'apPrograms' => $apPrograms,
'finalityTypes' => $finalityTypes,
'formatTypes' => $formatTypes,
// Page meta // Page meta
'searchBarValue' => $query, 'searchBarValue' => $query,
@@ -311,6 +317,12 @@ class SearchController
if (!empty($_GET['ap_program'])) { if (!empty($_GET['ap_program'])) {
$params['ap_program'] = (string) $_GET['ap_program']; $params['ap_program'] = (string) $_GET['ap_program'];
} }
if (!empty($_GET['finality'])) {
$params['finality'] = (string) $_GET['finality'];
}
if (!empty($_GET['format'])) {
$params['format'] = (string) $_GET['format'];
}
if (!empty($_GET['keyword'])) { if (!empty($_GET['keyword'])) {
$params['keyword'] = (string) $_GET['keyword']; $params['keyword'] = (string) $_GET['keyword'];
} }

View File

@@ -41,8 +41,32 @@
</select> </select>
</label> </label>
<button type="submit" class="btn btn--primary search-apply-btn">Filtrer</button> <label class="search-filter-label" for="filter-finality">Finalité
<a href="/search?query=<?= urlencode($_GET['query'] ?? '') ?>" class="search-reset-link">Réinitialiser</a> <select class="search-filter-select" name="finality" id="filter-finality">
<option value="">Toutes</option>
<?php foreach ($finalityTypes as $f): ?>
<option value="<?= htmlspecialchars($f['name']) ?>"
<?= (isset($_GET['finality']) && $_GET['finality'] == $f['name']) ? 'selected' : '' ?>>
<?= htmlspecialchars($f['name']) ?>
</option>
<?php endforeach; ?>
</select>
</label>
<label class="search-filter-label" for="filter-format">Format
<select class="search-filter-select" name="format" id="filter-format">
<option value="">Tous</option>
<?php foreach ($formatTypes as $fmt): ?>
<option value="<?= htmlspecialchars($fmt['name']) ?>"
<?= (isset($_GET['format']) && $_GET['format'] == $fmt['name']) ? 'selected' : '' ?>>
<?= htmlspecialchars($fmt['name']) ?>
</option>
<?php endforeach; ?>
</select>
</label>
<button type="submit" class="btn btn--primary btn--sm search-apply-btn">Filtrer</button>
<a href="/search?query=<?= urlencode($_GET['query'] ?? '') ?>" class="btn btn--secondary btn--sm search-reset-link">Réinitialiser</a>
</form> </form>
<main class="search-main" id="main-content"> <main class="search-main" id="main-content">