mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-30 12:36:45 +00:00
Add option to disable "toggle" for sidebar
This commit is contained in:
parent
890fd0f1a0
commit
6a3c9ead17
@ -354,6 +354,11 @@ loadSalesOrderTable("#table-so-overdue", {
|
|||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
enableSidebar('index');
|
enableSidebar(
|
||||||
|
'index',
|
||||||
|
{
|
||||||
|
hide_toggle: true,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -115,15 +115,20 @@ function enableSidebar(label, options={}) {
|
|||||||
activatePanel(label, panel_name);
|
activatePanel(label, panel_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add callback to "collapse" and "expand" the sidebar
|
if (options.hide_toggle) {
|
||||||
$('#sidebar-toggle').click(function() {
|
// Hide the toggle button if specified
|
||||||
|
$('#sidebar-toggle').remove();
|
||||||
|
} else {
|
||||||
|
$('#sidebar-toggle').click(function() {
|
||||||
|
// 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-menu-state-${label}`) || 'expanded';
|
var state = localStorage.getItem(`inventree-menu-state-${label}`) || 'expanded';
|
||||||
|
|
||||||
// We wish to "toggle" the state!
|
// We wish to "toggle" the state!
|
||||||
setSidebarState(label, state == "expanded" ? "collapsed" : "expanded");
|
setSidebarState(label, state == "expanded" ? "collapsed" : "expanded");
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Set the initial state (default = expanded)
|
// Set the initial state (default = expanded)
|
||||||
var state = localStorage.getItem(`inventree-menu-state-${label}`) || 'expanded';
|
var state = localStorage.getItem(`inventree-menu-state-${label}`) || 'expanded';
|
||||||
@ -132,6 +137,7 @@ function enableSidebar(label, options={}) {
|
|||||||
|
|
||||||
// Finally, show the sidebar
|
// Finally, show the sidebar
|
||||||
$('#sidebar').show();
|
$('#sidebar').show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
<a href="#" id='sidebar-toggle' class="list-group-item sidebar-list-group-item border-end-0 d-inline-block text-truncate sidebar-toggle" data-bs-parent="#sidebar">
|
<a href="#" id='sidebar-toggle' class="list-group-item sidebar-list-group-item border-end-0 d-inline-block text-truncate sidebar-toggle" data-bs-parent="#sidebar" style='display: none;'>
|
||||||
<i class="bi bi-bootstrap"></i><span id='sidebar-toggle-icon' class='sidebar-item-icon fas fa-chevron-left'></span>
|
<i class="bi bi-bootstrap"></i><span id='sidebar-toggle-icon' class='sidebar-item-icon fas fa-chevron-left'></span>
|
||||||
</a>
|
</a>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user