diff --git a/InvenTree/part/templates/part/detail.html b/InvenTree/part/templates/part/detail.html index 4c8a5e77ae..dc58eb772d 100644 --- a/InvenTree/part/templates/part/detail.html +++ b/InvenTree/part/templates/part/detail.html @@ -1114,4 +1114,6 @@ var SalePriceChart = loadSellPricingChart($('#SalePriceChart'), salepricedata) {% endif %} + enableSidebar('part'); + {% endblock %} diff --git a/InvenTree/part/templates/part/part_base.html b/InvenTree/part/templates/part/part_base.html index 43126b1fc7..c5f5f846a2 100644 --- a/InvenTree/part/templates/part/part_base.html +++ b/InvenTree/part/templates/part/part_base.html @@ -216,13 +216,6 @@ {% block js_ready %} {{ block.super }} - enableSidebar( - 'part', - { - default: 'part-details', - } - ); - {% if part.image %} $('#part-thumb').click(function() { showModalImage('{{ part.image.url }}'); diff --git a/InvenTree/stock/templates/stock/item.html b/InvenTree/stock/templates/stock/item.html index 5a38397dfc..554a8064e4 100644 --- a/InvenTree/stock/templates/stock/item.html +++ b/InvenTree/stock/templates/stock/item.html @@ -6,8 +6,8 @@ {% load l10n %} {% load markdownify %} -{% block menubar %} -{% include "stock/navbar.html" %} +{% block sidebar %} +{% include "stock/stock_sidebar.html" %} {% endblock %} {% block page_content %} @@ -397,4 +397,6 @@ url: "{% url 'api-stock-tracking-list' %}", }); + enableSidebar('stockitem'); + {% endblock %} diff --git a/InvenTree/stock/templates/stock/item_base.html b/InvenTree/stock/templates/stock/item_base.html index c5c895693f..51431d96cd 100644 --- a/InvenTree/stock/templates/stock/item_base.html +++ b/InvenTree/stock/templates/stock/item_base.html @@ -8,10 +8,6 @@ {% inventree_title %} | {% trans "Stock Item" %} - {{ item }} {% endblock %} -{% block sidenav %} -
-{% endblock %} - {% block breadcrumbs %} {% include 'stock/loc_link.html' with location=item.location %} {% endblock %} @@ -430,11 +426,6 @@ {% block js_ready %} {{ block.super }} -enableNavbar({ - label: 'item', - toggleId: '#item-menu-toggle', -}); - loadTree("{% url 'api-stock-tree' %}", "#stock-tree", { @@ -621,9 +612,4 @@ $("#stock-return-from-customer").click(function() { {% endif %} -attachNavCallbacks({ - name: 'stockitem', - default: 'history' -}); - {% endblock %} diff --git a/InvenTree/stock/templates/stock/navbar.html b/InvenTree/stock/templates/stock/navbar.html deleted file mode 100644 index 90c0075ba0..0000000000 --- a/InvenTree/stock/templates/stock/navbar.html +++ /dev/null @@ -1,61 +0,0 @@ -{% load i18n %} - - \ No newline at end of file diff --git a/InvenTree/stock/templates/stock/stock_sidebar.html b/InvenTree/stock/templates/stock/stock_sidebar.html new file mode 100644 index 0000000000..c3c2a7ed91 --- /dev/null +++ b/InvenTree/stock/templates/stock/stock_sidebar.html @@ -0,0 +1,16 @@ +{% load i18n %} +{% load static %} +{% load inventree_extras %} + +{% include "sidebar_item.html" with label='history' text="Stock Tracking" icon="fa-history" %} +{% if item.part.trackable %} +{% include "sidebar_item.html" with label='test-data' text="Test Data" icon="fa-vial" %} +{% endif %} +{% if item.part.assembly %} +{% include "sidebar_item.html" with label='installed-items' text="Installed Items" icon="fa-sign-in-alt" %} +{% endif %} +{% if item.child_count > 0 %} +{% include "sidebar_item.html" with label='children' text="Child Items" icon="fa-sitemap" %} +{% endif %} +{% include "sidebar_item.html" with label='attachments' text="Attachments" icon="fa-paperclip" %} +{% include "sidebar_item.html" with label='notes' text="Notes" icon="fa-clipboard" %} diff --git a/InvenTree/templates/js/dynamic/nav.js b/InvenTree/templates/js/dynamic/nav.js index b3736be347..6bbef86a14 100644 --- a/InvenTree/templates/js/dynamic/nav.js +++ b/InvenTree/templates/js/dynamic/nav.js @@ -8,41 +8,6 @@ onPanelLoad, */ -/* -* Attach callbacks to navigation bar elements. -* -* Searches for elements with the class 'nav-toggle'. -* A callback is added to each element, -* to display the matching panel. -* -* The 'id' of the .nav-toggle element should be of the form "select-", -* and point to a matching "panel-" -*/ -function attachNavCallbacksX(options={}) { - - $('.nav-toggle').click(function() { - var el = $(this); - - // Find the matching "panel" element - var panelName = el.attr('id').replace('select-', ''); - - activatePanel(panelName, options); - }); - - var panelClass = options.name || 'unknown'; - - /* Look for a default panel to initialize - * First preference = URL parameter e.g. ?display=part-stock - * Second preference = localStorage - * Third preference = default - */ - var defaultPanel = $.urlParam('display') || localStorage.getItem(`inventree-selected-panel-${panelClass}`) || options.default; - - if (defaultPanel) { - activatePanel(defaultPanel); - } -} - /* * Activate (display) the selected panel */ @@ -52,6 +17,8 @@ function activatePanel(label, panel_name, options={}) { $('.panel-visible').hide(); $('.panel-visible').removeClass('panel-visible'); + console.log('active panel:', label, panel_name); + // Find the target panel var panel = `#panel-${panel_name}`; var select = `#select-${panel_name}`;