mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Change "sidetree" to "breadcrumb-tree"
This commit is contained in:
parent
8c018cf987
commit
7dcd166d50
@ -6,9 +6,9 @@
|
|||||||
{% include 'part/category_sidebar.html' %}
|
{% include 'part/category_sidebar.html' %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block sidetree %}
|
{% block breadcrumb_tree %}
|
||||||
<div id="tree"></div>
|
<div id="breadcrumb-tree"></div>
|
||||||
{% endblock %}
|
{% endblock breadcrumb_tree %}
|
||||||
|
|
||||||
{% block heading %}
|
{% block heading %}
|
||||||
{% if category %}
|
{% if category %}
|
||||||
@ -243,8 +243,11 @@
|
|||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
// Enable left-hand navigation sidebar
|
||||||
enableSidebar('category');
|
enableSidebar('category');
|
||||||
enableSidetree('category');
|
|
||||||
|
// Enable breadcrumb tree view
|
||||||
|
enableBreadcrumbTree('category');
|
||||||
|
|
||||||
loadPartCategoryTable(
|
loadPartCategoryTable(
|
||||||
$('#subcategory-table'), {
|
$('#subcategory-table'), {
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
{% include 'part/part_sidebar.html' %}
|
{% include 'part/part_sidebar.html' %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block sidetree %}
|
{% block breadcrumb_tree %}
|
||||||
<div id="tree"></div>
|
<div id="breadcrumb-tree"></div>
|
||||||
{% endblock %}
|
{% endblock breadcrumb_tree %}
|
||||||
|
|
||||||
{% block page_content %}
|
{% block page_content %}
|
||||||
|
|
||||||
@ -1065,6 +1065,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
enableSidebar('part');
|
enableSidebar('part');
|
||||||
enableSidetree('part');
|
|
||||||
|
enableBreadcrumbTree('part');
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block breadcrumbs %}
|
{% block breadcrumbs %}
|
||||||
<a href='#' id='sidetree-toggle' class="breadcrumb-item"><i class="fas fa-bars"></i></a>
|
<a href='#' id='breadcrumb-tree-toggle' class="breadcrumb-item"><i class="fas fa-bars"></i></a>
|
||||||
{% if part %}
|
{% if part %}
|
||||||
{% include "part/cat_link.html" with category=part.category part=part %}
|
{% include "part/cat_link.html" with category=part.category part=part %}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
@ -105,23 +105,22 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block breadcrumb_list %}
|
{% block breadcrumb_list %}
|
||||||
<div class='container-fluid navigation'>
|
<div class='container-fluid navigation' id='breadcrumb-div'>
|
||||||
<nav aria-label='breadcrumb'>
|
<nav aria-label='breadcrumb'>
|
||||||
<ol class='breadcrumb'>
|
<ol class='breadcrumb' id='breadcrumb-list'>
|
||||||
{% block breadcrumbs %}
|
{% block breadcrumbs %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</ol>
|
</ol>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
<div class='col-auto px-1 sidebar-wrapper'>
|
<div id='breadcrumb-tree-collapse' class='collapse collapse-horizontal show border' style='display: none;'>
|
||||||
<div id='sidetree' class='collapse collapse-horizontal show border' style='display: none;'>
|
{% block breadcrumb_tree %}
|
||||||
{% block sidetree %}
|
{% endblock %}
|
||||||
{% endblock %}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<!-- Each view fills in here.. -->
|
<!-- Each view fills in here.. -->
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
addSidebarHeader,
|
addSidebarHeader,
|
||||||
addSidebarItem,
|
addSidebarItem,
|
||||||
addSidebarLink,
|
addSidebarLink,
|
||||||
|
enableBreadcrumbTree,
|
||||||
enableSidebar,
|
enableSidebar,
|
||||||
enableSidetree,
|
|
||||||
onPanelLoad,
|
onPanelLoad,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -147,10 +147,10 @@ function enableSidebar(label, options={}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable support for a sidetree on this page
|
* Enable support for breadcrumb tree navigation on this page
|
||||||
*/
|
*/
|
||||||
function enableSidetree(label) {
|
function enableBreadcrumbTree(label) {
|
||||||
$('#tree').jstree({
|
$('#breadcrumb-tree').jstree({
|
||||||
'core': {
|
'core': {
|
||||||
'data': {
|
'data': {
|
||||||
'url': '/api/part/category/tree/',
|
'url': '/api/part/category/tree/',
|
||||||
@ -167,29 +167,29 @@ function enableSidetree(label) {
|
|||||||
window.location.href = data.node.a_attr.href;
|
window.location.href = data.node.a_attr.href;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#sidetree-toggle').click(function() {
|
$('#breadcrumb-tree-toggle').click(function() {
|
||||||
// Add callback to "collapse" and "expand" the sidebar
|
// Add callback to "collapse" and "expand" the sidebar
|
||||||
|
|
||||||
// By default, the menu is "expanded"
|
// By default, the menu is "expanded"
|
||||||
var state = localStorage.getItem(`inventree-tree-state-${label}`) || 'expanded';
|
var state = localStorage.getItem(`inventree-tree-state-${label}`) || 'expanded';
|
||||||
|
|
||||||
// We wish to "toggle" the state!
|
// We wish to "toggle" the state!
|
||||||
setSidetreeState(label, state == 'expanded' ? 'collapsed' : 'expanded');
|
setBreadcrumbTreeState(label, state == 'expanded' ? 'collapsed' : 'expanded');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set the initial state (default = expanded)
|
// Set the initial state (default = expanded)
|
||||||
var state = localStorage.getItem(`inventree-tree-state-${label}`) || 'expanded';
|
var state = localStorage.getItem(`inventree-tree-state-${label}`) || 'expanded';
|
||||||
|
|
||||||
setSidetreeState(label, state);
|
setBreadcrumbTreeState(label, state);
|
||||||
|
|
||||||
|
function setBreadcrumbTreeState(label, state) {
|
||||||
|
|
||||||
function setSidetreeState(label, state) {
|
|
||||||
if (state == 'collapsed') {
|
if (state == 'collapsed') {
|
||||||
$('#sidetree').hide(100);
|
$('#breadcrumb-tree-collapse').hide(100);
|
||||||
$(`#sidetree-toggle-icon`).removeClass('fa-chevron-left').addClass('fa-chevron-right');
|
|
||||||
} else {
|
} else {
|
||||||
$('#sidetree').show(100);
|
$('#breadcrumb-tree-collapse').show(100);
|
||||||
$(`#sidetree-toggle-icon`).removeClass('fa-chevron-right').addClass('fa-chevron-left');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
localStorage.setItem(`inventree-tree-state-${label}`, state);
|
localStorage.setItem(`inventree-tree-state-${label}`, state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user