diff --git a/InvenTree/InvenTree/static/script/inventree/inventree.js b/InvenTree/InvenTree/static/script/inventree/inventree.js index 79e02d7da5..70cb3b292f 100644 --- a/InvenTree/InvenTree/static/script/inventree/inventree.js +++ b/InvenTree/InvenTree/static/script/inventree/inventree.js @@ -80,6 +80,16 @@ function inventreeDocReady() { attachClipboard('.clip-btn'); attachClipboard('.clip-btn', 'modal-about'); // modals attachClipboard('.clip-btn-version', 'modal-about', 'about-copy-text'); // version-text + + // Add autocomplete to the search-bar + $("#search-bar" ).autocomplete({ + source: "{% url 'search-api' %}", + minLength: 2, + classes: {'ui-autocomplete': 'dropdown-menu'}, + select: function( event, ui ) { + window.location = '/part/' + ui.item.id + '/'; + } + }); } function isFileTransfer(transfer) { diff --git a/InvenTree/templates/base.html b/InvenTree/templates/base.html index e887032f66..9d4eaa5142 100644 --- a/InvenTree/templates/base.html +++ b/InvenTree/templates/base.html @@ -191,15 +191,6 @@ $(document).ready(function () { {% endif %} moment.locale('{{request.LANGUAGE_CODE}}'); - - $("#search-bar" ).autocomplete({ - source: "{% url 'search-api' %}", - minLength: 2, - classes: {'ui-autocomplete': 'dropdown-menu'}, - select: function( event, ui ) { - window.location = '/part/' + ui.item.id + '/'; - } - }); });