- Ajout nom de la recherche
This commit is contained in:
@ -31,11 +31,13 @@ class APISearchController extends AbstractController
|
|||||||
{
|
{
|
||||||
// Appeler la méthode search et récupérer les résultats
|
// Appeler la méthode search et récupérer les résultats
|
||||||
$datas = $this->search($request);
|
$datas = $this->search($request);
|
||||||
|
$query = $request->query->get('q');
|
||||||
|
|
||||||
// Afficher les résultats dans le template
|
// Afficher les résultats dans le template
|
||||||
return $this->render('apiSearch/index.html.twig', [
|
return $this->render('apiSearch/index.html.twig', [
|
||||||
'controller_name' => 'APISearchController',
|
'controller_name' => 'APISearchController',
|
||||||
'datas' => $datas,
|
'datas' => $datas,
|
||||||
|
'query' => $query,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
{% extends 'base.html.twig' %}
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
{% block title %}Hello APITestController!{% endblock %}
|
{% block title %}{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
|
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
<h1>Recherche de livre pour {{ query }}</h1>
|
||||||
{% for book in datas.items %}
|
{% for book in datas.items %}
|
||||||
<div class="flex justify-center">
|
<div class="flex justify-center">
|
||||||
<div class="border rounded-xl w-1/2 py-2 flex flex-col justify-center mt-5">
|
<div class="border rounded-xl w-1/2 py-2 flex flex-col justify-center mt-5">
|
||||||
|
@ -24,11 +24,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if error %}
|
|
||||||
<div class="text-red-500 text-sm mt-2">
|
|
||||||
{{ error.messageKey|trans(error.messageData, 'security') }}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<div class="mt-6 text-center">
|
<div class="mt-6 text-center">
|
||||||
<button type="submit" class="w-full px-4 py-2 bg-indigo-600 text-white font-semibold rounded-md hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500">
|
<button type="submit" class="w-full px-4 py-2 bg-indigo-600 text-white font-semibold rounded-md hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500">
|
||||||
|
Reference in New Issue
Block a user