autocomplete: Submit form on item selection
This commit is contained in:
parent
713401cf95
commit
9a27c7ae20
3 changed files with 7 additions and 2 deletions
|
|
@ -24,6 +24,7 @@ AutoComplete({
|
||||||
Limit: 10,
|
Limit: 10,
|
||||||
MinChars: 4,
|
MinChars: 4,
|
||||||
Delay: 500,
|
Delay: 500,
|
||||||
|
SelectCallback: _ => document.getElementById("search-form").requestSubmit(),
|
||||||
}, "#search-input");
|
}, "#search-input");
|
||||||
|
|
||||||
},{"autocomplete-js":2}],2:[function(require,module,exports){
|
},{"autocomplete-js":2}],2:[function(require,module,exports){
|
||||||
|
|
@ -242,6 +243,7 @@ var AutoComplete = /** @class */ (function () {
|
||||||
HttpMethod: "GET",
|
HttpMethod: "GET",
|
||||||
QueryArg: "q",
|
QueryArg: "q",
|
||||||
Url: null,
|
Url: null,
|
||||||
|
SelectCallback: null,
|
||||||
KeyboardMappings: {
|
KeyboardMappings: {
|
||||||
"Enter": {
|
"Enter": {
|
||||||
Conditions: [{
|
Conditions: [{
|
||||||
|
|
@ -564,6 +566,9 @@ var AutoComplete = /** @class */ (function () {
|
||||||
this.Input.value = item.innerHTML;
|
this.Input.value = item.innerHTML;
|
||||||
}
|
}
|
||||||
this.Input.setAttribute("data-autocomplete-old-value", this.Input.value);
|
this.Input.setAttribute("data-autocomplete-old-value", this.Input.value);
|
||||||
|
if (this.SelectCallback) {
|
||||||
|
this.SelectCallback();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Handle HTTP error on the request
|
* Handle HTTP error on the request
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1" />
|
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1" />
|
||||||
<link rel="stylesheet" href="/static/style.css?v=9">
|
<link rel="stylesheet" href="/static/style.css?v=9">
|
||||||
<link rel="stylesheet" href="/static/banner.css">
|
<link rel="stylesheet" href="/static/banner.css">
|
||||||
<link rel="stylesheet" href="/static/autocomplete.css">
|
<link rel="stylesheet" href="/static/autocomplete.css?v=2">
|
||||||
<script>
|
<script>
|
||||||
document.documentElement.classList.remove('no-js');
|
document.documentElement.classList.remove('no-js');
|
||||||
document.documentElement.classList.add('js');
|
document.documentElement.classList.add('js');
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<div class="search">
|
<div class="search">
|
||||||
<form method="post" action="{{ ident_base_url }}">
|
<form method="post" action="{{ ident_base_url }}" id="search-form">
|
||||||
<select name="f" title="Restricts search to specific file families">
|
<select name="f" title="Restricts search to specific file families">
|
||||||
{% for id, description in topbar_families.items() %}
|
{% for id, description in topbar_families.items() %}
|
||||||
<option value="{{ id }}" {{ 'selected' if (current_family == id or current_family is not defined) else '' }}>
|
<option value="{{ id }}" {{ 'selected' if (current_family == id or current_family is not defined) else '' }}>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue