mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +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 %}
|
||||
|
||||
enableSidebar('index');
|
||||
enableSidebar(
|
||||
'index',
|
||||
{
|
||||
hide_toggle: true,
|
||||
}
|
||||
);
|
||||
|
||||
{% endblock %}
|
@ -115,15 +115,20 @@ function enableSidebar(label, options={}) {
|
||||
activatePanel(label, panel_name);
|
||||
}
|
||||
|
||||
// Add callback to "collapse" and "expand" the sidebar
|
||||
$('#sidebar-toggle').click(function() {
|
||||
if (options.hide_toggle) {
|
||||
// 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"
|
||||
var state = localStorage.getItem(`inventree-menu-state-${label}`) || 'expanded';
|
||||
|
||||
// We wish to "toggle" the state!
|
||||
setSidebarState(label, state == "expanded" ? "collapsed" : "expanded");
|
||||
});
|
||||
// By default, the menu is "expanded"
|
||||
var state = localStorage.getItem(`inventree-menu-state-${label}`) || 'expanded';
|
||||
|
||||
// We wish to "toggle" the state!
|
||||
setSidebarState(label, state == "expanded" ? "collapsed" : "expanded");
|
||||
});
|
||||
}
|
||||
|
||||
// Set the initial state (default = expanded)
|
||||
var state = localStorage.getItem(`inventree-menu-state-${label}`) || 'expanded';
|
||||
@ -132,6 +137,7 @@ function enableSidebar(label, options={}) {
|
||||
|
||||
// Finally, show the sidebar
|
||||
$('#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>
|
||||
</a>
|
||||
|
Loading…
Reference in New Issue
Block a user