recherche full texte
This commit is contained in:
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+12
-12
File diff suppressed because one or more lines are too long
@@ -91,6 +91,9 @@ gsap.registerPlugin(ScrollTrigger);
|
||||
let header_right = document.getElementById('burger-btn');
|
||||
header_right.parentElement.addEventListener('click', function(e){
|
||||
// console.log('click header_right', this);
|
||||
// Le champ de recherche du burger vit dans ce conteneur : y cliquer
|
||||
// (pour saisir, ou sur la loupe) ne doit pas refermer le menu.
|
||||
if (e.target.closest('form')) return;
|
||||
this.firstElementChild.toggleAttribute('opened');
|
||||
this.firstElementChild.nextElementSibling.toggleAttribute('opened');
|
||||
})
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
@use "partials/global/base";
|
||||
@use "partials/global/layout";
|
||||
@use "partials/global/header";
|
||||
@use "partials/global/search-form";
|
||||
@use "partials/global/variable-titles";
|
||||
|
||||
// ── Pages (l'ordre ci-dessous EST la cascade) ──────────────────────────────
|
||||
@@ -15,3 +16,4 @@
|
||||
@use "partials/pages/evenement";
|
||||
@use "partials/pages/views-archives-projets";
|
||||
@use "partials/pages/views-archives-evenements";
|
||||
@use "partials/pages/recherche";
|
||||
|
||||
@@ -135,12 +135,22 @@ header[role="banner"]{
|
||||
grid-row: 1 / -1;
|
||||
}
|
||||
|
||||
// Recherche (templates/search-form.html.twig) : sous la langue.
|
||||
>form.search-pill{
|
||||
--search-pill-width: 22rem;
|
||||
margin-top: 1.5em;
|
||||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
@media #{$mobile}{
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
grid-template-rows: none;
|
||||
>div#block-leshed-config-pages{
|
||||
grid-column: 1;
|
||||
grid-row: auto;
|
||||
// Après la recherche, qui suit la langue (maquette p. 24).
|
||||
order: 1;
|
||||
margin-top: 1.5em;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
// ____ _
|
||||
// / ___| ___ __ _ _ __ ___| |__
|
||||
// \___ \ / _ \/ _` | '__/ __| '_ \
|
||||
// ___) | __/ (_| | | | (__| | | |
|
||||
// |____/ \___|\__,_|_| \___|_| |_|
|
||||
//
|
||||
// Champ de recherche « pilule » (templates/search-form.html.twig) : burger
|
||||
// et page /recherche (maquette p. 3, 22, 24). Contour noir fin, loupe à
|
||||
// droite ; la largeur est donnée par le contexte (--search-pill-width).
|
||||
|
||||
form.search-pill{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
width: var(--search-pill-width, 16rem);
|
||||
max-width: 100%;
|
||||
height: 2.3em;
|
||||
padding: 0 0.35em 0 1em;
|
||||
border: 1px solid #000;
|
||||
border-radius: 999px;
|
||||
background-color: #fff;
|
||||
|
||||
input[type="search"]{
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
font: inherit;
|
||||
font-weight: 300;
|
||||
color: #000;
|
||||
outline: none;
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
&::placeholder{
|
||||
color: #555;
|
||||
opacity: 1;
|
||||
}
|
||||
// Croix native d'effacement : pas dans la maquette.
|
||||
&::-webkit-search-cancel-button{
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
}
|
||||
|
||||
button{
|
||||
flex: 0 0 auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 2em;
|
||||
height: 2em;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: #000;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
// Focus : le contour s'épaissit (pas d'anneau extérieur, absent de la
|
||||
// maquette, mais un repère visible au clavier).
|
||||
&:focus-within{
|
||||
box-shadow: 0 0 0 1px #000;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
// ____ _ _
|
||||
// | _ \ ___ ___| |__ ___ _ __ ___| |__ ___
|
||||
// | |_) / _ \/ __| '_ \ / _ \ '__/ __| '_ \ / _ \
|
||||
// | _ < __/ (__| | | | __/ | | (__| | | | __/
|
||||
// |_| \_\___|\___|_| |_|\___|_| \___|_| |_|\___|
|
||||
//
|
||||
// Page /recherche (vue recherche, page_1 — maquette p. 22) : en-tête
|
||||
// « Résultats pour la recherche "…" » + champ à droite, grille de teasers.
|
||||
|
||||
@use "../abstracts/variables" as *;
|
||||
@use "../abstracts/nodes-on-liste" as *;
|
||||
@use "../abstracts/breakpoints" as *;
|
||||
|
||||
@mixin carteRecherche{
|
||||
>header>h2{
|
||||
font-size: 3em;
|
||||
}
|
||||
.body,
|
||||
.field_infos_pratiques,
|
||||
.field_lieu{
|
||||
display: none;
|
||||
}
|
||||
.field_artiste_s_invite_s,
|
||||
.field_type_de_projet,
|
||||
.field_type_d_evenement{
|
||||
font-size: 0.9em;
|
||||
font-weight: 300;
|
||||
line-height: 1.3;
|
||||
}
|
||||
.field_artiste_s_invite_s{
|
||||
margin-top: 0.4em;
|
||||
}
|
||||
}
|
||||
|
||||
div.views-recherche{
|
||||
>header.recherche-header{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 1em $colsgap;
|
||||
padding: 1em 0 2.5em;
|
||||
|
||||
p.recherche-resume{
|
||||
margin: 0;
|
||||
em{
|
||||
font-style: italic;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
form.search-pill{
|
||||
--search-pill-width: 15rem;
|
||||
}
|
||||
}
|
||||
|
||||
// Même grille que les archives projets : 4 colonnes, 2 en mobile.
|
||||
div.view-content{
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
column-gap: $colsgap;
|
||||
row-gap: 0;
|
||||
align-items: start;
|
||||
>.views-row{
|
||||
margin-bottom: $colsgap;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
@media #{$mobile}{
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
// Maquette p. 22 : titre, image, artistes et type en petit, sans résumé.
|
||||
// Surcharges posées après les mixins, à la même spécificité.
|
||||
article.node-type-projet.view-mode-teaser{
|
||||
@include projetOnListe();
|
||||
@include carteRecherche();
|
||||
}
|
||||
article.node-type-evenement.view-mode-teaser{
|
||||
@include evenementOnListe();
|
||||
@include carteRecherche();
|
||||
}
|
||||
|
||||
div.view-empty{
|
||||
padding-bottom: 4em;
|
||||
}
|
||||
|
||||
nav.pager{
|
||||
ul{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 1em;
|
||||
padding: 0;
|
||||
li{ list-style: none; }
|
||||
li.is-active{ font-weight: 600; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -361,3 +361,20 @@ function leshed_preprocess_links__language_block(&$variables){
|
||||
function leshed_preprocess_time(&$variables){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_preprocess_HOOK() for views-view--recherche--page-1.
|
||||
*
|
||||
* Expose les termes cherchés au template (en-tête « Résultats pour la
|
||||
* recherche "…" » et champ pré-rempli). Texte brut : Twig l'échappe.
|
||||
*/
|
||||
function leshed_preprocess_views_view__recherche(&$variables) {
|
||||
$input = $variables['view']->getExposedInput();
|
||||
$variables['search_keys'] = trim((string) ($input['search'] ?? ''));
|
||||
// « ?search= » vide : le plugin input_required le compte comme saisi et
|
||||
// Views renverrait tout l'index. Pas de terme, pas de résultat.
|
||||
if ($variables['search_keys'] === '') {
|
||||
$variables['rows'] = [];
|
||||
$variables['pager'] = [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
<div{{ attributes }}>
|
||||
<div class="inner-wrapper">
|
||||
{{ content }}
|
||||
|
||||
{# Recherche plein texte : envoie vers la vue « recherche » (/recherche,
|
||||
/en/recherche), même paramètre que son formulaire exposé. #}
|
||||
{% include '@leshed/search-form.html.twig' with { id: 'burger-search' } only %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
{#
|
||||
/**
|
||||
* @file
|
||||
* Champ de recherche « pilule » (maquette p. 3, 22, 24), réutilisé dans le
|
||||
* burger. Envoie en GET vers la vue recherche, paramètre « search ».
|
||||
*
|
||||
* Variables :
|
||||
* - id : id du champ (unique dans la page).
|
||||
* - value : texte pré-rempli (facultatif).
|
||||
*/
|
||||
#}
|
||||
<form class="search-pill" action="{{ path('view.recherche.page_1') }}" method="get" role="search">
|
||||
<label class="visually-hidden" for="{{ id }}">{{ 'Rechercher sur le site'|t }}</label>
|
||||
<input type="search" id="{{ id }}" name="search" value="{{ value }}" placeholder="{{ 'Rechercher sur le site…'|t }}" required minlength="2">
|
||||
<button type="submit" aria-label="{{ 'Rechercher'|t }}">{% include '@leshed/search-icon.html.twig' %}</button>
|
||||
</form>
|
||||
@@ -0,0 +1 @@
|
||||
<svg class="search-icon" viewBox="0 0 24 24" width="16" height="16" aria-hidden="true" focusable="false"><circle cx="10.5" cy="10.5" r="6.5" fill="none" stroke="currentColor" stroke-width="2"/><path d="M15.5 15.5 21 21" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>
|
||||
|
After Width: | Height: | Size: 302 B |
@@ -0,0 +1,42 @@
|
||||
{#
|
||||
/**
|
||||
* @file
|
||||
* Page de résultats de la vue Recherche (maquette p. 22) : ligne d'en-tête
|
||||
* « Résultats pour la recherche "…" » + champ pilule à droite, puis grille
|
||||
* de teasers (projets et événements).
|
||||
*
|
||||
* Variable ajoutée par leshed_preprocess_views_view__recherche() :
|
||||
* - search_keys : termes cherchés (texte brut, échappé par Twig).
|
||||
*
|
||||
* @see template_preprocess_views_view()
|
||||
*/
|
||||
#}
|
||||
{%
|
||||
set classes = [
|
||||
dom_id ? 'js-view-dom-id-' ~ dom_id,
|
||||
]
|
||||
%}
|
||||
<div{{ attributes.addClass(classes) }}>
|
||||
{{ title_prefix }}
|
||||
{{ title_suffix }}
|
||||
|
||||
<header class="recherche-header">
|
||||
{% if search_keys %}
|
||||
<p class="recherche-resume">{{ 'Résultats pour la recherche'|t }} "<em>{{ search_keys }}</em>"</p>
|
||||
{% else %}
|
||||
<p class="recherche-resume">{{ 'Rechercher sur le site'|t }}</p>
|
||||
{% endif %}
|
||||
{# Même champ que le burger plutôt que le formulaire exposé de Views :
|
||||
même markup, même style ; « search » est l'identifiant du filtre. #}
|
||||
{% include '@leshed/search-form.html.twig' with { id: 'recherche-search', value: search_keys } only %}
|
||||
</header>
|
||||
|
||||
{% if rows -%}
|
||||
<div class="view-content">
|
||||
{{ rows }}
|
||||
</div>
|
||||
{% elseif empty and search_keys -%}
|
||||
<div class="view-empty">{{ empty }}</div>
|
||||
{% endif %}
|
||||
{{ pager }}
|
||||
</div>
|
||||
Reference in New Issue
Block a user