mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
#6797: Implement new sidebar
This commit is contained in:
@@ -1,70 +1,57 @@
|
||||
{% load helpers %}
|
||||
|
||||
<ul class="nav nav-pills nav-flush flex-column mb-auto text-center">
|
||||
{% comment %} <li class="nav-item">
|
||||
<a href="/" class="nav-link active py-3" aria-current="page" title="Home" data-bs-toggle="tooltip" data-bs-placement="right">
|
||||
<i class="mdi mdi-home"></i>
|
||||
</a>
|
||||
</li> {% endcomment %}
|
||||
<ul class="navbar-nav">
|
||||
{% for menu in nav_items %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#menu{{ menu.label }}" data-bs-toggle="collapse" role="button" aria-expanded="false" aria-controls="menu{{ menu.label }}">
|
||||
<i class="{{ menu.icon_class }}"></i>
|
||||
<span class="nav-link-text">{{ menu.label }}</span>
|
||||
</a>
|
||||
<div class="collapse" id="menu{{ menu.label }}">
|
||||
<ul class="nav nav-sm flex-column">
|
||||
|
||||
{% for menu in nav_items %}
|
||||
<li class="nav-item sidenav-dropdown">
|
||||
<div class="nav-label">
|
||||
{{ menu.label }}
|
||||
</div>
|
||||
<div class="dropdown dropend" title="{{ menu.label }}">
|
||||
<a href="#" class="nav-link py-3 dropdown-toggle" id="menu{{ menu.label }}" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<i class="{{ menu.icon_class }}"></i>
|
||||
</a>
|
||||
|
||||
<ul class="dropdown-menu shadow" aria-labelledby="menu{{ menu.label }}">
|
||||
<li><h4 class="dropdown-header text-dark">{{ menu.label }}</h4>{{ menu.has_link }}</li>
|
||||
<hr class="dropdown-divider" />
|
||||
|
||||
{% for group in menu.groups %}
|
||||
{# Within each main menu, there are groups of menu items #}
|
||||
|
||||
{% if group.label != menu.label %}
|
||||
<li><h6 class="dropdown-header">{{ group.label }}</h6></li>
|
||||
{% endif %}
|
||||
|
||||
{% for item in group.items %}
|
||||
{# Each Menu Item #}
|
||||
{% if request.user|has_perms:item.permissions %}
|
||||
<li class="dropdown-item-group">
|
||||
|
||||
<a class="dropdown-item" href="{% url item.link %}">{{ item.link_text }}</a>
|
||||
{# Menu item buttons (if any) #}
|
||||
{% if item.buttons %}
|
||||
<div class="btn-group ps-1">
|
||||
{% for button in item.buttons %}
|
||||
{% if request.user|has_perms:button.permissions %}
|
||||
<a class="btn btn-sm btn-{{ button.color }} lh-1" href="{% url button.link %}" title="{{ button.title }}">
|
||||
<i class="{{ button.icon_class }}"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% for group in menu.groups %}
|
||||
{# Within each main menu, there are groups of menu items #}
|
||||
<li class="nav-item">
|
||||
<div class="nav-link">
|
||||
{# Group Label #}
|
||||
<span class="nav-group-label">{{ group.label }}</span>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
{% for item in group.items %}
|
||||
{# Each Item #}
|
||||
{% if request.user|has_perms:item.permissions %}
|
||||
<li class="nav-item">
|
||||
<a href="{% url item.link %}" class="nav-link">
|
||||
<span class="sidenav-normal">{{ item.link_text }}</span>
|
||||
</a>
|
||||
|
||||
{# Menu item buttons (if any) #}
|
||||
{% if item.buttons %}
|
||||
<div class="btn-group px-2">
|
||||
{% for button in item.buttons %}
|
||||
{% if request.user|has_perms:button.permissions %}
|
||||
<a class="btn btn-sm btn-{{ button.color }} lh-1" href="{% url button.link %}" title="{{ button.title }}">
|
||||
<i class="{{ button.icon_class }}"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% else %}
|
||||
{# Display a disabled link (no permission) #}
|
||||
<li class="nav-item disabled">
|
||||
<a href="#" class="nav-link disabled" aria-disabled="true" disabled>
|
||||
<span class="sidenav-normal">{{ item.link_text }}</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% else %}
|
||||
{# Display a disabled link (no permission) #}
|
||||
<li class="dropdown-item-group disabled">
|
||||
<a class="dropdown-item disabled" href="#" aria-disabled="true" disabled>
|
||||
{{ item.link_text }}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{# Show a divider if not the last group #}
|
||||
{% if forloop.counter != menu.groups|length %}
|
||||
<hr class="dropdown-divider my-2" />
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
Reference in New Issue
Block a user