-
- -
-
-

-
-
-
+
+
{% 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(
+ `
`
);
- // 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);
});