mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-17 13:08:16 -06:00
Fixes #8813 Retain search value after submitting
This commit is contained in:
parent
6807db4967
commit
055c67f6be
@ -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 #}
|
||||
|
@ -5,7 +5,11 @@
|
||||
aria-label="Search"
|
||||
placeholder="Search"
|
||||
class="form-control"
|
||||
value="{{ request.GET.q }}"
|
||||
value=""
|
||||
{% if request.GET.q %}
|
||||
autofocus
|
||||
onfocus="this.value = '{{ request.GET.q|escapejs }}';"
|
||||
{% endif %}
|
||||
/>
|
||||
|
||||
<input name="obj_type" hidden type="text" class="search-obj-type" />
|
||||
|
@ -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,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user