Files
ArchiveBox/archivebox/templates/admin/search_form.html
Nick Sweeting b749b26c5d wip
2026-03-23 03:58:32 -07:00

44 lines
3.9 KiB
HTML

{% load i18n static %}
{% if cl.search_fields %}
<div id="toolbar">
<h2 id="changelist-search-form" class="visually-hidden">{% blocktranslate with name=cl.opts.verbose_name_plural %}Search {{ name }}{% endblocktranslate %}</h2>
<form id="changelist-search" method="get" role="search" aria-labelledby="changelist-search-form">
<div><!-- DIV needed for valid HTML -->
<label for="searchbar"><img src="{% static "admin/img/search.svg" %}" alt="Search"></label>
<input type="text" size="40" name="{{ search_var }}" value="{{ cl.query }}" id="searchbar"{% if cl.search_help_text %} aria-describedby="searchbar_helptext"{% endif %}>
<input type="submit" value="{% translate 'Search' %}">
{% if cl.model_admin.show_search_mode_selector %}
{% with current_search_mode=cl.params.search_mode|default:cl.model_admin.get_default_search_mode %}
<span style="display:inline-flex; flex:0 0 auto; flex-wrap:nowrap; gap:8px; align-items:center; margin-left:10px; font-size:12px; white-space:nowrap; vertical-align:middle;">
<label style="display:inline-flex; align-items:center; gap:6px; min-width:88px; padding:4px 20px 4px 10px; border-radius:999px; border:1px solid {% if current_search_mode == 'meta' %}#93c5fd{% else %}#d1d5db{% endif %}; background:{% if current_search_mode == 'meta' %}#dbeafe{% else %}#fff{% endif %}; color:{% if current_search_mode == 'meta' %}#1d4ed8{% else %}#374151{% endif %}; box-sizing:border-box;">
<input type="radio" name="search_mode" value="meta"{% if current_search_mode == "meta" %} checked{% endif %} style="margin:0;">
<span aria-hidden="true">🗂️</span>
<span>meta</span>
</label>
<label style="display:inline-flex; align-items:center; gap:6px; min-width:112px; padding:4px 20px 4px 10px; border-radius:999px; border:1px solid {% if current_search_mode == 'contents' %}#86efac{% else %}#d1d5db{% endif %}; background:{% if current_search_mode == 'contents' %}#dcfce7{% else %}#fff{% endif %}; color:{% if current_search_mode == 'contents' %}#166534{% else %}#374151{% endif %}; box-sizing:border-box;">
<input type="radio" name="search_mode" value="contents"{% if current_search_mode == "contents" %} checked{% endif %} style="margin:0;">
<span aria-hidden="true">🔎</span>
<span>contents</span>
</label>
<label style="display:inline-flex; align-items:center; gap:6px; min-width:88px; padding:4px 20px 4px 10px; border-radius:999px; border:1px solid {% if current_search_mode == 'deep' %}#c4b5fd{% else %}#d1d5db{% endif %}; background:{% if current_search_mode == 'deep' %}#ede9fe{% else %}#fff{% endif %}; color:{% if current_search_mode == 'deep' %}#6d28d9{% else %}#374151{% endif %}; box-sizing:border-box;">
<input type="radio" name="search_mode" value="deep"{% if current_search_mode == "deep" %} checked{% endif %} style="margin:0;">
<span aria-hidden="true">🪜</span>
<span>deep</span>
</label>
</span>
{% endwith %}
{% endif %}
{% if show_result_count %}
<span class="small quiet">{% blocktranslate count counter=cl.result_count %}{{ counter }} result{% plural %}{{ counter }} results{% endblocktranslate %} (<a href="?{% if cl.is_popup %}{{ is_popup_var }}=1{% if cl.add_facets %}&{% endif %}{% endif %}{% if cl.add_facets %}{{ is_facets_var }}{% endif %}">{% if cl.show_full_result_count %}{% blocktranslate with full_result_count=cl.full_result_count %}{{ full_result_count }} total{% endblocktranslate %}{% else %}{% translate "Show all" %}{% endif %}</a>)</span>
{% endif %}
{% for pair in cl.params.items %}
{% if pair.0 != search_var and pair.0 != "search_mode" %}<input type="hidden" name="{{ pair.0 }}" value="{{ pair.1 }}">{% endif %}
{% endfor %}
</div>
{% if cl.search_help_text %}
<br class="clear">
<div class="help" id="searchbar_helptext">{{ cl.search_help_text }}</div>
{% endif %}
</form></div>
{% endif %}