From 11a6052871c0b2e8ec28aa89fb84978c18db268b Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 29 Mar 2022 22:46:00 +1100 Subject: [PATCH] remove the old search bar --- .../static/script/inventree/inventree.js | 75 ------------------- InvenTree/templates/navbar.html | 2 +- 2 files changed, 1 insertion(+), 76 deletions(-) diff --git a/InvenTree/InvenTree/static/script/inventree/inventree.js b/InvenTree/InvenTree/static/script/inventree/inventree.js index b7cacd5860..f991ed3766 100644 --- a/InvenTree/InvenTree/static/script/inventree/inventree.js +++ b/InvenTree/InvenTree/static/script/inventree/inventree.js @@ -128,81 +128,6 @@ function inventreeDocReady() { attachClipboard('.clip-btn', 'modal-about'); attachClipboard('.clip-btn-version', 'modal-about', 'about-copy-text'); - // Add autocomplete to the search-bar - if ($('#search-bar').exists()) { - $('#search-bar').autocomplete({ - source: function(request, response) { - - var params = { - search: request.term, - limit: user_settings.SEARCH_PREVIEW_RESULTS, - offset: 0, - }; - - if (user_settings.SEARCH_HIDE_INACTIVE_PARTS) { - // Limit to active parts - params.active = true; - } - - $.ajax({ - url: '/api/part/', - data: params, - success: function(data) { - - var transformed = $.map(data.results, function(el) { - return { - label: el.full_name, - id: el.pk, - thumbnail: el.thumbnail, - data: el, - }; - }); - response(transformed); - }, - error: function() { - response([]); - } - }); - }, - create: function() { - $(this).data('ui-autocomplete')._renderItem = function(ul, item) { - - var html = ` -
- - ${item.label} - - - `; - - if (user_settings.SEARCH_SHOW_STOCK_LEVELS) { - html += partStockLabel( - item.data, - { - classes: 'badge-right', - } - ); - } - - html += '
'; - - return $('
  • ').append(html).appendTo(ul); - }; - }, - select: function( event, ui ) { - window.location = '/part/' + ui.item.id + '/'; - }, - minLength: 2, - classes: { - 'ui-autocomplete': 'dropdown-menu search-menu', - }, - position: { - my : "right top", - at: "right bottom" - } - }); - } - // Generate brand-icons $('.brand-icon').each(function(i, obj) { loadBrandIcon($(this), $(this).attr('brand_name')); diff --git a/InvenTree/templates/navbar.html b/InvenTree/templates/navbar.html index 1a6e43039e..d687300eb4 100644 --- a/InvenTree/templates/navbar.html +++ b/InvenTree/templates/navbar.html @@ -87,7 +87,7 @@ {% if demo %} {% include "navbar_demo.html" %} {% endif %} - {% include "search_form.html" %} +