From 59acf45ab98aceaed521622781c1248190ea362f Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 29 Oct 2021 00:29:09 +1100 Subject: [PATCH] Implement sidebar for "part category" display --- InvenTree/InvenTree/static/css/inventree.css | 1 + InvenTree/part/templates/part/category.html | 9 +- .../part/templates/part/category_navbar.html | 45 ------- .../part/templates/part/category_sidebar.html | 15 +++ InvenTree/part/templates/part/navbar.html | 120 ------------------ InvenTree/templates/base.html | 2 +- InvenTree/templates/js/dynamic/nav.js | 2 +- InvenTree/templates/sidebar_link.html | 4 + 8 files changed, 25 insertions(+), 173 deletions(-) delete mode 100644 InvenTree/part/templates/part/category_navbar.html create mode 100644 InvenTree/part/templates/part/category_sidebar.html delete mode 100644 InvenTree/part/templates/part/navbar.html create mode 100644 InvenTree/templates/sidebar_link.html diff --git a/InvenTree/InvenTree/static/css/inventree.css b/InvenTree/InvenTree/static/css/inventree.css index 4469568d1e..d823bc15c7 100644 --- a/InvenTree/InvenTree/static/css/inventree.css +++ b/InvenTree/InvenTree/static/css/inventree.css @@ -916,6 +916,7 @@ input[type="date"].form-control, input[type="time"].form-control, input[type="da .sidebar-wrapper { overflow-y: auto; + background: var(--secondary-color); } .sidebar-item-icon { diff --git a/InvenTree/part/templates/part/category.html b/InvenTree/part/templates/part/category.html index 5cede4d803..5a3dbcd281 100644 --- a/InvenTree/part/templates/part/category.html +++ b/InvenTree/part/templates/part/category.html @@ -2,8 +2,8 @@ {% load static %} {% load i18n %} -{% block menubar %} -{% include 'part/category_navbar.html' %} +{% block sidebar %} +{% include 'part/category_sidebar.html' %} {% endblock %} {% block details_left %} @@ -214,10 +214,7 @@ ); {% endif %} - enableNavbar({ - label: 'category', - toggleId: '#category-menu-toggle', - }); + enableSidebar('category'); $('#view-list').click(function() { $('#view-list').hide(); diff --git a/InvenTree/part/templates/part/category_navbar.html b/InvenTree/part/templates/part/category_navbar.html deleted file mode 100644 index aa3a491160..0000000000 --- a/InvenTree/part/templates/part/category_navbar.html +++ /dev/null @@ -1,45 +0,0 @@ -{% load i18n %} -{% load inventree_extras %} - -{% settings_value 'PART_SHOW_IMPORT' as show_import %} - - \ No newline at end of file diff --git a/InvenTree/part/templates/part/category_sidebar.html b/InvenTree/part/templates/part/category_sidebar.html new file mode 100644 index 0000000000..37c5acc73c --- /dev/null +++ b/InvenTree/part/templates/part/category_sidebar.html @@ -0,0 +1,15 @@ +{% load i18n %} +{% load static %} +{% load inventree_extras %} + +{% settings_value 'PART_SHOW_IMPORT' as show_import %} + +{% include "sidebar_item.html" with label="subcategories" text="Subcategories" icon="fa-sitemap" %} +{% include "sidebar_item.html" with label="parts" text="Parts" icon="fa-shapes" %} +{% if show_import and user.is_staff and roles.part.add %} +{% url "part-import" as url %} +{% include "sidebar_link.html" with url=url text="Import Parts" icon="fa-file-upload" %} +{% endif %} +{% if category %} +{% include "sidebar_item.html" with label="parameters" text="Parameters" icon="fa-tasks" %} +{% endif %} \ No newline at end of file diff --git a/InvenTree/part/templates/part/navbar.html b/InvenTree/part/templates/part/navbar.html deleted file mode 100644 index 95a7857c2c..0000000000 --- a/InvenTree/part/templates/part/navbar.html +++ /dev/null @@ -1,120 +0,0 @@ -{% load i18n %} -{% load static %} -{% load inventree_extras %} - -{% settings_value "PART_INTERNAL_PRICE" as show_internal_price %} -{% settings_value 'PART_SHOW_RELATED' as show_related %} - - diff --git a/InvenTree/templates/base.html b/InvenTree/templates/base.html index fd6e5490f6..d253475e49 100644 --- a/InvenTree/templates/base.html +++ b/InvenTree/templates/base.html @@ -70,7 +70,7 @@
-