Update web/templates/search.html

This commit is contained in:
2025-08-13 05:46:40 +00:00
parent 1b3be124e1
commit 24b6cc98fe
+32 -34
View File
@@ -1,36 +1,34 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block title %}Search - Illustrations DB{% endblock %} {% load static %}
{% block content %} {% block content %}
<div class="panel"> <div class="container">
<h1>Search</h1> <h1 class="page-title">Search</h1>
{% if ran_search %} <p class="page-subtitle">Use wildcards: <code>*</code> matches many characters (e.g., <code>*love*</code>), <code>?</code> matches one. By default we search Subject, Illustration, and Application.</p>
{% if result_count and result_count > 0 %}
<div class="flash">Found <strong>{{ result_count }}</strong> matching entries. Opening the first match…</div> <form method="get" class="search-form">
{% else %} <div class="search-row">
<div class="flash">No results found for <code>{{ q }}</code> in the selected fields.</div> <input type="text" name="q" value="{{ q }}" placeholder="Type to search…" class="search-input" autofocus>
{% endif %} <button class="btn btn-primary">Search</button>
{% endif %} </div>
<p class="small"><strong>How to search:</strong> Type words or phrases (quotes for exact), use wildcards, and choose which fields to search.</p>
<form method="get" action="/search/"> <div class="filter-row">
<div class="row"> {% for f in field_options %}
<div> <label class="check-pill">
<label>Search terms</label> <input type="checkbox" name="{{ f.name }}" {% if f.checked %}checked{% endif %}>
<input type="text" name="q" value="{{ q|default:'' }}" placeholder="Type words, phrases, or wildcards…" /> <span>{{ f.label }}</span>
</div> </label>
<div> {% endfor %}
<label>Fields to search</label> </div>
<div class="chips">
{% for opt in field_options %} <div class="muted small">Total entries: {{ total }}</div>
<label class="badge"><input type="checkbox" name="{{ opt.name }}" {% if opt.checked %}checked{% endif %}/> {{ opt.label }}</label> </form>
{% endfor %}
</div> {% if ran_search and result_count == 0 %}
</div> <div class="empty-state">
</div> <div class="empty-title">No results</div>
<div style="margin-top:16px; display:flex; gap:10px; justify-content:flex-end;"> <div class="empty-subtitle">Try broadening your terms or enabling more fields above.</div>
<button class="btn primary" type="submit">Search</button> </div>
</div> {% endif %}
</form> </div>
</div> {% endblock %}
<div class="spacer"></div>
<div class="small">Total entries in database: <strong>{{ total }}</strong></div>
{% endblock %}