39 lines
1.8 KiB
HTML
39 lines
1.8 KiB
HTML
{% extends "base.html" %}
|
|
{% load static i18n wagtailcore_tags %}
|
|
|
|
{% block body_class %}template-searchresults{% endblock %}
|
|
|
|
{% block title %}Search{% endblock %}
|
|
|
|
{% block content %}
|
|
<h1 class="text-3xl font-bold mb-6 text-gray-800">{% trans "Search" %}</h1>
|
|
|
|
<form action="{% url 'search' %}" method="get" class="flex flex-col md:flex-row items-center gap-4 mb-8">
|
|
<input type="text" name="query"{% if search_query %} value="{{ search_query }}"{% endif %} class="border border-gray-300 rounded px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 w-full md:w-auto">
|
|
<input type="submit" value="{% trans 'Search' %}" class="bg-blue-600 text-white px-4 py-2 rounded hover:bg-blue-700 transition">
|
|
</form>
|
|
|
|
{% if search_results %}
|
|
<ul class="space-y-6">
|
|
{% for result in search_results %}
|
|
<li class="bg-white rounded shadow p-4">
|
|
<h4 class="text-lg font-semibold mb-2"><a href="{% pageurl result %}" class="text-blue-600 hover:underline">{{ result }}</a></h4>
|
|
{% if result.search_description %}
|
|
{{ result.search_description }}
|
|
{% endif %}
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
|
|
{% if search_results.has_previous %}
|
|
<a href="{% url 'search' %}?query={{ search_query|urlencode }}&page={{ search_results.previous_page_number }}" class="inline-block bg-gray-200 text-gray-700 px-3 py-1 rounded hover:bg-gray-300 mr-2">{% trans "Previous" %}</a>
|
|
{% endif %}
|
|
|
|
{% if search_results.has_next %}
|
|
<a href="{% url 'search' %}?query={{ search_query|urlencode }}&page={{ search_results.next_page_number }}" class="inline-block bg-gray-200 text-gray-700 px-3 py-1 rounded hover:bg-gray-300">{% trans "Next" %}</a>
|
|
{% endif %}
|
|
{% elif search_query %}
|
|
<div class="text-red-600 font-semibold mt-8">{% trans "No results found" %}</div>
|
|
{% endif %}
|
|
{% endblock %}
|