diff --git a/InvenTree/InvenTree/static/css/inventree.css b/InvenTree/InvenTree/static/css/inventree.css index d823bc15c7..4b9cc5937b 100644 --- a/InvenTree/InvenTree/static/css/inventree.css +++ b/InvenTree/InvenTree/static/css/inventree.css @@ -917,6 +917,8 @@ input[type="date"].form-control, input[type="time"].form-control, input[type="da .sidebar-wrapper { overflow-y: auto; background: var(--secondary-color); + margin-top: 1rem; + padding-top: 0.25rem; } .sidebar-item-icon { diff --git a/InvenTree/templates/InvenTree/index.html b/InvenTree/templates/InvenTree/index.html index 88ee6e53f2..eec261e056 100644 --- a/InvenTree/templates/InvenTree/index.html +++ b/InvenTree/templates/InvenTree/index.html @@ -14,9 +14,7 @@ {% block content %} -

{% inventree_title %}

-
-
+
{% endblock %} @@ -303,4 +301,4 @@ enableSidebar( } ); -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/templates/InvenTree/search.html b/InvenTree/templates/InvenTree/search.html index 06b51e995f..34f4a541fe 100644 --- a/InvenTree/templates/InvenTree/search.html +++ b/InvenTree/templates/InvenTree/search.html @@ -10,35 +10,19 @@ {% block content %} -

- {% trans "Search Results" %} -

- -
- {% include "search_form.html" with query_text=query %} -
- -{% if query %} -{% else %} -
-

{% trans "Enter a search query" %}

-
-{% endif %} - -
-
-
    -
+
+
+ {% include "search_form.html" with query_text=query %} + {% if query %} + {% else %} +
+

{% trans "Enter a search query" %}

+
+ {% endif %}
-
-
    -
  • -
    - -
    -
  • -
+ +
{% endblock %} @@ -47,69 +31,50 @@ {{ block.super }} function addItemTitle(title) { - // Add header block to the results list - $('#search-item-list').append( - `
  • ${title}
  • ` - ); + addSidebarHeader({ + text: title, + }); } function addItem(label, title, icon, options) { - // Add a search itme to the action list - $('#search-item-list').append( - `
  • - - - ${title} - - - - -
  • ` - ); + + // Construct a "badge" to add to the sidebar item + var badge = ` + + + + `; + + addSidebarItem({ + label: label, + text: title, + icon: icon, + content_after: badge + }); // Add a results table - $('#search-result-list').append( - `
  • -

    ${title}

    -
    -
  • ` + $('#detail-panels').append( + `
    +
    +

    ${title}

    +
    +
    +
    +
    +
    ` ); - // Hide the results table - $(`#search-result-${label}`).hide(); - - // Add callback when the action is clicked - $(`#search-item-${label}`).click(function() { - - // Hide all childs - $('#search-result-list').children('li').each(function() { - $(this).hide(); - }); - - // Show the one we want - $(`#search-result-${label}`).fadeIn(); - - // Remove css class from all action items - $("#search-item-list").children('li').each(function() { - $(this).removeClass('index-action-selected'); - }); - - // Add css class to the action we are interested in - $(`#search-item-${label}`).addClass('index-action-selected'); - }); - // Connect a callback to the table $(`#table-${label}`).on('load-success.bs.table', function() { var count = $(`#table-${label}`).bootstrapTable('getData').length; - $(`#badge-${label}`).html(count); + var badge = $(`#sidebar-badge-${label}`); - $(`#badge-${label}`).removeClass('bg-dark'); + badge.html(count); if (count > 0) { - $(`#badge-${label}`).addClass('bg-primary'); - } else { - $(`#badge-${label}`).addClass('bg-warning'); + badge.removeClass('bg-dark'); + badge.addClass('bg-primary'); } }); } @@ -264,7 +229,11 @@ {% endif %} + enableSidebar( + 'search', + { + hide_toggle: 'true', + } + ); - - -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/templates/js/dynamic/nav.js b/InvenTree/templates/js/dynamic/nav.js index f4dad6a3d3..6eb84a9de8 100644 --- a/InvenTree/templates/js/dynamic/nav.js +++ b/InvenTree/templates/js/dynamic/nav.js @@ -96,8 +96,6 @@ function enableSidebar(label, options={}) { // Find the matching panel element to display var panel_name = el.attr('id').replace('select-', ''); - console.log("activating panel:", panel_name); - activatePanel(label, panel_name, options); });