mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 08:09:18 +02:00
search: ajout filtres finalité et format, boutons plus compacts et Réinitialiser en neutre
This commit is contained in:
@@ -250,7 +250,7 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
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);
|
||||
flex-shrink: 0;
|
||||
flex-wrap: wrap;
|
||||
@@ -278,21 +278,9 @@
|
||||
border: 2px solid var(--accent-primary);
|
||||
}
|
||||
|
||||
.search-apply-btn {
|
||||
/* deprecated alias for .btn--primary; kept for backward-compat */
|
||||
}
|
||||
|
||||
.search-apply-btn,
|
||||
.search-reset-link {
|
||||
font-size: var(--step--1);
|
||||
color: var(--text-secondary);
|
||||
text-decoration: none;
|
||||
font-weight: 400;
|
||||
cursor: pointer;
|
||||
transition: color 0.15s;
|
||||
}
|
||||
|
||||
.search-reset-link:hover {
|
||||
color: var(--accent-primary);
|
||||
/* btn--sm classes handle styling; space kept for potential overrides */
|
||||
}
|
||||
|
||||
/* Search results pagination */
|
||||
|
||||
@@ -87,6 +87,8 @@ class SearchController
|
||||
$years = [];
|
||||
$orientations = [];
|
||||
$apPrograms = [];
|
||||
$finalityTypes = [];
|
||||
$formatTypes = [];
|
||||
$coverMap = [];
|
||||
|
||||
try {
|
||||
@@ -100,6 +102,8 @@ class SearchController
|
||||
$years = $this->db->getAvailableYears();
|
||||
$orientations = $this->db->getAllOrientations();
|
||||
$apPrograms = $this->db->getAllAPPrograms();
|
||||
$finalityTypes = $this->db->getAllFinalityTypes();
|
||||
$formatTypes = $this->db->getAllFormatTypes();
|
||||
if (!empty($results)) {
|
||||
$coverMap = $this->db->getCoverPathsForTheses(array_column($results, 'id'));
|
||||
}
|
||||
@@ -129,6 +133,8 @@ class SearchController
|
||||
'years' => $years,
|
||||
'orientations' => $orientations,
|
||||
'apPrograms' => $apPrograms,
|
||||
'finalityTypes' => $finalityTypes,
|
||||
'formatTypes' => $formatTypes,
|
||||
|
||||
// Page meta
|
||||
'searchBarValue' => $query,
|
||||
@@ -311,6 +317,12 @@ class SearchController
|
||||
if (!empty($_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'])) {
|
||||
$params['keyword'] = (string) $_GET['keyword'];
|
||||
}
|
||||
|
||||
@@ -41,8 +41,32 @@
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<button type="submit" class="btn btn--primary search-apply-btn">Filtrer</button>
|
||||
<a href="/search?query=<?= urlencode($_GET['query'] ?? '') ?>" class="search-reset-link">Réinitialiser</a>
|
||||
<label class="search-filter-label" for="filter-finality">Finalité
|
||||
<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>
|
||||
|
||||
<main class="search-main" id="main-content">
|
||||
|
||||
Reference in New Issue
Block a user