mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-17 20:45:44 +00:00
Adding search auto-complete #280
This commit is contained in:
@ -191,6 +191,14 @@ $(document).ready(function () {
|
||||
{% endif %}
|
||||
|
||||
moment.locale('{{request.LANGUAGE_CODE}}');
|
||||
|
||||
$("#search-bar" ).autocomplete({
|
||||
source: "{% url 'search-api' %}",
|
||||
minLength: 2,
|
||||
select: function( event, ui ) {
|
||||
window.location = '/part/' + ui.item.id + '/';
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<form class="navbar-form navbar-left" action="{% url 'search' %}" method='post'>
|
||||
{% csrf_token %}
|
||||
<div class="form-group">
|
||||
<input type="text" name='search' class="form-control" placeholder="{% trans 'Search' %}"{% if query_text %} value="{{ query }}"{% endif %}>
|
||||
<input type="text" name='search' class="form-control" id="search-bar" placeholder="{% trans 'Search' %}"{% if query_text %} value="{{ query }}"{% endif %}>
|
||||
</div>
|
||||
<button type="submit" id='search-submit' class="btn btn-default" title='{% trans "Search" %}'>
|
||||
<span class='fas fa-search'></span>
|
||||
|
Reference in New Issue
Block a user