Fixes #8813 Retain search value after submitting (#8907)

* Fixes #8813 Retain search value after submitting

* remove autofocus from searchbar

Co-authored-by: Pieter Lambrecht <pieter.lambrecht@sentia.com>
This commit is contained in:
PieterL75 2022-03-18 18:23:39 +01:00 committed by GitHub
parent 9a0bb14e76
commit 0da04232f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 5 deletions

View File

@ -33,7 +33,7 @@
</button>
</div>
<div class="d-flex my-1 flex-grow-1 justify-content-center w-100">
{% search_options %}
{% search_options request %}
</div>
</div>
@ -45,7 +45,7 @@
{# Search bar #}
<div class="col-6 d-flex flex-grow-1 justify-content-center">
{% search_options %}
{% search_options request %}
</div>
{# Proflie/login button #}

View File

@ -5,7 +5,7 @@
aria-label="Search"
placeholder="Search"
class="form-control"
value="{{ request.GET.q }}"
value="{{ request.GET.q|escape }}"
/>
<input name="obj_type" hidden type="text" class="search-obj-type" />

View File

@ -8,6 +8,9 @@ search_form = SearchForm()
@register.inclusion_tag("search/searchbar.html")
def search_options() -> Dict:
def search_options(request) -> Dict:
"""Provide search options to template."""
return {"options": search_form.options}
return {
'options': search_form.options,
'request': request,
}