Update web/templates/search.html

This commit is contained in:
Joshua Laymon 2025-08-13 05:46:40 +00:00
parent 1b3be124e1
commit 24b6cc98fe

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 %}
<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="row">
<div>
<label>Search terms</label>
<input type="text" name="q" value="{{ q|default:'' }}" placeholder="Type words, phrases, or wildcards…" />
</div> </div>
<div>
<label>Fields to search</label> <div class="filter-row">
<div class="chips"> {% for f in field_options %}
{% for opt in field_options %} <label class="check-pill">
<label class="badge"><input type="checkbox" name="{{ opt.name }}" {% if opt.checked %}checked{% endif %}/> {{ opt.label }}</label> <input type="checkbox" name="{{ f.name }}" {% if f.checked %}checked{% endif %}>
<span>{{ f.label }}</span>
</label>
{% endfor %} {% endfor %}
</div> </div>
</div>
</div> <div class="muted small">Total entries: {{ total }}</div>
<div style="margin-top:16px; display:flex; gap:10px; justify-content:flex-end;">
<button class="btn primary" type="submit">Search</button>
</div>
</form> </form>
{% if ran_search and result_count == 0 %}
<div class="empty-state">
<div class="empty-title">No results</div>
<div class="empty-subtitle">Try broadening your terms or enabling more fields above.</div>
</div>
{% endif %}
</div> </div>
<div class="spacer"></div>
<div class="small">Total entries in database: <strong>{{ total }}</strong></div>
{% endblock %} {% endblock %}