mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Implement sidebar for "part category" display
This commit is contained in:
parent
f0fe7f2d5c
commit
59acf45ab9
@ -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 {
|
||||
|
@ -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();
|
||||
|
@ -1,45 +0,0 @@
|
||||
{% load i18n %}
|
||||
{% load inventree_extras %}
|
||||
|
||||
{% settings_value 'PART_SHOW_IMPORT' as show_import %}
|
||||
|
||||
<ul class='list-group'>
|
||||
|
||||
<li class='list-group-item'>
|
||||
<a href='#' id='category-menu-toggle'>
|
||||
<span class='menu-tab-icon fas fa-expand-arrows-alt'></span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class='list-group-item' title='{% trans "Subcategories" %}'>
|
||||
<a href='#' id='select-subcategories' class='nav-toggle'>
|
||||
<span class='fas fa-sitemap sidebar-icon'></span>
|
||||
{% trans "Subcategories" %}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class='list-group-item' title='{% trans "Parts" %}'>
|
||||
<a href='#' id='select-parts' class='nav-toggle'>
|
||||
<span class='fas fa-shapes sidebar-icon'></span>
|
||||
{% trans "Parts" %}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
{% if show_import and user.is_staff and roles.part.add %}
|
||||
<li class='list-group-item' title='{% trans "Import Parts" %}'>
|
||||
<a href='{% url "part-import" %}'>
|
||||
<span class='fas fa-file-upload sidebar-icon'></span>
|
||||
{% trans "Import Parts" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if category %}
|
||||
<li class='list-group-item' title='{% trans "Parameters" %}'>
|
||||
<a href='#' id='select-parameters' class='nav-toggle'>
|
||||
<span class='fas fa-tasks sidebar-icon'></span>
|
||||
{% trans "Parameters" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
15
InvenTree/part/templates/part/category_sidebar.html
Normal file
15
InvenTree/part/templates/part/category_sidebar.html
Normal file
@ -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 %}
|
@ -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 %}
|
||||
|
||||
<ul class='list-group'>
|
||||
<li class='list-group-item'>
|
||||
<a href='#' id='part-menu-toggle'>
|
||||
<span class='menu-tab-icon fas fa-expand-arrows-alt'></span>
|
||||
</a>
|
||||
</li>
|
||||
<li class='list-group-item' title='{% trans "Details" %}'>
|
||||
<a href='#' id='select-part-details' class='nav-toggle'>
|
||||
<span class='menu-tab-icon fas fa-info-circle sidebar-icon'></span>
|
||||
{% trans "Details" %}
|
||||
</a>
|
||||
</li>
|
||||
<li class='list-group-item' title='{% trans "Parameters" %}'>
|
||||
<a href='#' id='select-part-parameters' class='nav-toggle'>
|
||||
<span class='menu-tab-icon fas fa-th-list sidebar-icon'></span>
|
||||
{% trans "Parameters" %}
|
||||
</a>
|
||||
</li>
|
||||
{% if part.is_template %}
|
||||
<li class='list-group-item' title='{% trans "Part Variants" %}'>
|
||||
<a href='#' id='select-variants' class='nav-toggle'>
|
||||
<span class='menu-tab-icon fas fa-shapes sidebar-icon'></span>
|
||||
{% trans "Variants" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li class='list-group-item' title='{% trans "Stock Items" %}'>
|
||||
<a href='#' id='select-part-stock' class='nav-toggle'>
|
||||
<span class='menu-tab-icon fas fa-boxes sidebar-icon'></span>
|
||||
{% trans "Stock" %}
|
||||
</a>
|
||||
</li>
|
||||
{% if part.assembly %}
|
||||
<li class='list-group-item' title='{% trans "Bill of Materials" %}'>
|
||||
<a href='#' id='select-bom' class='nav-toggle'>
|
||||
<span class='menu-tab-icon fas fa-list sidebar-icon'></span>
|
||||
{% trans "Bill of Materials" %}
|
||||
</a>
|
||||
</li>
|
||||
{% if roles.build.view %}
|
||||
<li class='list-group-item ' title='{% trans "Build Orders" %}'>
|
||||
<a href='#' id='select-build-orders' class='nav-toggle'>
|
||||
<span class='menu-tab-icon fas fa-tools sidebar-icon'></span>
|
||||
{% trans "Build Orders" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if part.component %}
|
||||
<li class='list-group-item ' title='{% trans "Used In" %}'>
|
||||
<a href='#' id='select-used-in' class='nav-toggle'>
|
||||
<span class='menu-tab-icon fas fa-layer-group sidebar-icon'></span>
|
||||
{% trans "Used In" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li class='list-group-item' title='{% trans "Pricing Information" %}'>
|
||||
<a href='#' id='select-pricing' class='nav-toggle'>
|
||||
<span class='menu-tab-icon fas fa-dollar-sign sidebar-icon'></span>
|
||||
{% trans "Prices" %}
|
||||
</a>
|
||||
</li>
|
||||
{% if part.purchaseable and roles.purchase_order.view %}
|
||||
<li class='list-group-item' title='{% trans "Suppliers" %}'>
|
||||
<a href='#' id='select-suppliers' class='nav-toggle'>
|
||||
<span class='menu-tab-icon fas fa-building sidebar-icon'></span>
|
||||
{% trans "Suppliers" %}
|
||||
</a>
|
||||
</li>
|
||||
<li class='list-group-item' title='{% trans "Purchase Orders" %}'>
|
||||
<a href='#' id='select-purchase-orders' class='nav-toggle'>
|
||||
<span class='menu-tab-icon fas fa-shopping-cart sidebar-icon'></span>
|
||||
{% trans "Purchase Orders" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if part.salable and roles.sales_order.view %}
|
||||
<li class='list-group-item' title='{% trans "Sales Orders" %}'>
|
||||
<a href='#' id='select-sales-orders' class='nav-toggle'>
|
||||
<span class='menu-tab-icon fas fa-truck sidebar-icon'></span>
|
||||
{% trans "Sales Orders" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if part.trackable %}
|
||||
<li class='list-group-item' title='{% trans "Part Test Templates" %}'>
|
||||
<a href='#' id='select-test-templates' class='nav-toggle'>
|
||||
<span class='menu-tab-icon fas fa-vial sidebar-icon'></span>
|
||||
{% trans "Test Templates" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if show_related %}
|
||||
<li class='list-group-item' title='{% trans "Related Parts" %}'>
|
||||
<a href='#' id='select-related-parts' class='nav-toggle'>
|
||||
<span class='menu-tab-icon fas fa-random sidebar-icon'></span>
|
||||
{% trans "Related Parts" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li class='list-group-item' title='{% trans "Attachments" %}'>
|
||||
<a href='#' id='select-part-attachments' class='nav-toggle'>
|
||||
<span class='fas fa-paperclip side-icon'></span>
|
||||
{% trans "Attachments" %}
|
||||
</a>
|
||||
</li>
|
||||
<li class='list-group-item' title='{% trans "Notes" %}'>
|
||||
<a href='#' id='select-part-notes' class='nav-toggle'>
|
||||
<span class='fas fa-clipboard side-icon'></span>
|
||||
{% trans "Notes" %}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
@ -70,7 +70,7 @@
|
||||
<div class='main body wrapper container-fluid inventree-body'>
|
||||
|
||||
<div class='row flex-nowrap inventree-body'>
|
||||
<div class='sidebar-wrapper col-auto px-1'>
|
||||
<div class='col-auto px-1 sidebar-wrapper'>
|
||||
<div id='sidebar' class='collapse collapse-horizontal show border-end' style='display: none;'>
|
||||
<div id='sidebar-nav' class='list-group text-sm-start'>
|
||||
<ul class='list-group sidebar-list-group'>
|
||||
|
@ -273,7 +273,7 @@ function initNavTree(options) {
|
||||
/**
|
||||
* Enable support for sidebar on this page
|
||||
*/
|
||||
function enableSidebar(label, options) {
|
||||
function enableSidebar(label, options={}) {
|
||||
|
||||
// Enable callbacks for sidebar buttons
|
||||
$('.sidebar-selector').click(function() {
|
||||
|
4
InvenTree/templates/sidebar_link.html
Normal file
4
InvenTree/templates/sidebar_link.html
Normal file
@ -0,0 +1,4 @@
|
||||
{% load i18n %}
|
||||
<a href="{{ url }}" class="list-group-item sidebar-list-group-item border-end-0 d-inline-block text-truncate sidebar-selector" data-bs-parent="#sidebar">
|
||||
<i class="bi bi-bootstrap"></i><span class='sidebar-item-icon fas {{ icon }}'></span><span class='sidebar-item-text' style='display: none;'>{% trans text %}</span>
|
||||
</a>
|
Loading…
Reference in New Issue
Block a user