Skip to content

Commit

Permalink
Merge pull request #10 from nad2000/main
Browse files Browse the repository at this point in the history
make active current model in the navigation
  • Loading branch information
app-generator authored Aug 12, 2022
2 parents 58c007b + ec59c71 commit ad51d2c
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions admin_volt/templates/admin/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,12 @@ <h2 class="h5 mb-3">Hi, {{ request.user.first_name|default:request.user.username
{% for app in app_list %}
{% if app.has_perms and not app.pinned %}
<li class="nav-item">
<span class="nav-link collapsed d-flex justify-content-between align-items-center" data-bs-toggle="collapse" data-bs-target="#submenu-{{ app.app_label }}">
<span class="nav-link{% if app_label != app.label and app.url not in request.path|urlencode %} collapsed{% endif %} d-flex justify-content-between align-items-center" data-bs-toggle="collapse" data-bs-target="#submenu-{{ app.app_label }}">
<span>
<span class="sidebar-icon {{ app.icon }}"></span>
<span class="sidebar-text">{{ app.label|slice:18 }}{% if app.label|length > 18 %}..{% endif %}</span>
<a href="{{ app.url }}">
<span class="sidebar-text">{{ app.label|slice:18 }}{% if app.label|length > 18 %}..{% endif %}</span>
</a>
</span>
{% if app.models %}
<span class="link-arrow">
Expand All @@ -75,13 +77,14 @@ <h2 class="h5 mb-3">Hi, {{ request.user.first_name|default:request.user.username
</span>

{% if app.models %}
<div class="multi-level collapse {% if 'tables-bootstrap-' in segment %} show {% endif %}" role="list" id="submenu-{{ app.app_label }}" aria-expanded="false">
<div class="multi-level collapse {% if 'tables-bootstrap-' in segment or app_label == app.label or app.url in request.path|urlencode %} show {% endif %}" role="list" id="submenu-{{ app.app_label }}"
aria-expanded="{% if app_label == app.label or app.url in request.path|urlencode %}true{% else %}false{% endif %}">
<ul class="flex-column nav">
{% for model in app.models %}
{% if model.url %}
<li class="nav-item {% if 'bootstrap-tables' in segment %} active {% endif %}">
<li class="nav-item{% if 'bootstrap-tables' in segment or model.url in request.path|urlencode %} active {% endif %}">
<a class="nav-link" href="{{ model.url }}">
<span class="sidebar-text">{{ model.label }}</span>
<span class="sidebar-text">{{ model.label }}</span>
</a>
</li>
{% else %}
Expand All @@ -97,4 +100,4 @@ <h2 class="h5 mb-3">Hi, {{ request.user.first_name|default:request.user.username
{% endif %}
</ul>
</div>
</nav>
</nav>

0 comments on commit ad51d2c

Please sign in to comment.