better error message when no results found

This commit is contained in:
Emilien Devos 2023-09-18 21:41:52 +02:00 committed by Markus Heiser
parent ad725ce7d7
commit 33e722f83b
4 changed files with 22 additions and 3 deletions

View File

@ -176,6 +176,15 @@ div.selectable_url {
border-color: var(--color-error);
}
.dialog-error-block {
.dialog();
display: block;
color: var(--color-error);
background: var(--color-error-background);
border-color: var(--color-error);
}
.dialog-warning {
.dialog();

View File

@ -1,5 +1,9 @@
<div id="engines_msg">
{% if not results and not answers %}
<details class="sidebar-collapsable" open>
{% else %}
<details class="sidebar-collapsable">
{% endif %}
<summary class="title" id="engines_msg-title">{{ _('Messages from the search engines') }}</summary>
<div class="dialog-error" role="alert">
{{ icon_big('warning') }}

View File

@ -1,5 +1,11 @@
{% from 'simple/icons.html' import icon_big %}
<div class="dialog-error" role="alert">
<div class="dialog-error-block" role="alert">
<p><strong>{{ _('Sorry!') }}</strong></p>
<p>{{ _("we didn't find any results. Please use another query or search in more categories.") }}</p>
<p>{{ _("No results were found. You can try to:") }}</p>
<ul>
<li>{{ _("Refresh the page.") }}</li>
<li>{{ _("Search for another query or select another category (above).") }}</li>
<li>{{ _("Change the search engine used in the preferences:") }} <a href="/preferences">/preferences</a></li>
<li>{{ _("Switch to another instance:") }} <a href="https://searx.space">https://searx.space</a></li>
</ul>
</div>

View File

@ -75,4 +75,4 @@ def test_search(browser):
browser.visit(url)
browser.fill('q', 'test search query')
browser.find_by_xpath('//button[@type="submit"]').first.click()
assert browser.is_text_present('didn\'t find any results')
assert browser.is_text_present('No results were found')