Catch sidebar error

This commit is contained in:
Oliver 2021-10-30 00:15:19 +11:00
parent a15cc1f3ba
commit a792903a79
3 changed files with 7 additions and 6 deletions

View File

@ -4,7 +4,7 @@
{% load static %} {% load static %}
{% block sidebar %} {% block sidebar %}
{% url 'part-index' as url %] {% url 'part-index' as url %}
{% include "sidebar_link.html" with url=url text="Return to Parts" icon="fa-undo" %} {% include "sidebar_link.html" with url=url text="Return to Parts" icon="fa-undo" %}
{% endblock %} {% endblock %}

View File

@ -114,10 +114,11 @@ function enableSidebar(label, options={}) {
// Find the "first" available panel (according to the sidebar) // Find the "first" available panel (according to the sidebar)
var selector = $('.sidebar-selector').first(); var selector = $('.sidebar-selector').first();
if (selector.exists()) {
var panel_name = selector.attr('id').replace('select-', ''); var panel_name = selector.attr('id').replace('select-', '');
activatePanel(label, panel_name); activatePanel(label, panel_name);
} }
}
if (options.hide_toggle) { if (options.hide_toggle) {
// Hide the toggle button if specified // Hide the toggle button if specified

View File

@ -1,4 +1,4 @@
{% load i18n %} {% 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"> <a href="{{ url }}" class="list-group-item sidebar-list-group-item border-end-0 d-inline-block text-truncate" 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> <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> </a>