Relayout of nav

This commit is contained in:
Ian Roddis committed 2026-07-02 13:38:43 -03:00
1 parent 59184124e7
commit 7fcf5b3f75
2 files changed
+130 -40

No files matched your search

+71
View File
@@ -57,6 +57,7 @@ a:hover {
.topbar nav {
display: flex;
align-items: center;
gap: 1rem;
}
@@ -67,6 +68,76 @@ a:hover {
gap: 0.75rem;
}
/* Nav dropdowns */
.nav-group {
position: relative;
line-height: 1;
}
.nav-label {
cursor: default;
color: #a5b4fc;
white-space: nowrap;
user-select: none;
}
.nav-label:hover {
text-decoration: underline;
}
.nav-dropdown {
display: none;
position: absolute;
top: calc(100% + 6px);
left: 0;
background: var(--surface);
border: 1px solid var(--border);
border-radius: 8px;
padding: 0.3rem 0;
min-width: 180px;
z-index: 200;
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.nav-group:hover > .nav-dropdown {
display: block;
}
.nav-dropdown a {
display: block;
padding: 0.38rem 0.9rem;
white-space: nowrap;
color: #a5b4fc;
}
.nav-dropdown a:hover {
background: var(--surface-2);
text-decoration: none;
}
.nav-dropdown hr {
border: none;
border-top: 1px solid var(--border);
margin: 0.3rem 0;
}
/* Second-level group inside a dropdown */
.nav-dropdown .nav-group > .nav-label {
display: block;
padding: 0.38rem 0.9rem;
}
.nav-dropdown .nav-group:hover > .nav-label {
background: var(--surface-2);
text-decoration: none;
}
.nav-dropdown .nav-group > .nav-dropdown {
top: -0.3rem;
left: 100%;
margin-left: 2px;
}
/* Cards */
.card {
background: var(--surface);
+59 -40
View File
@@ -1,52 +1,71 @@
{% set su = user.is_superuser %}
{% set p = user.permissions %}
{% set can_admin = su or "users:read" in p or "roles:read" in p or "audit_log:read" in p %}
{% set can_connections = su or "clamp_connections:read" in p or "iso_threads:read" in p or "static_connections:read" in p or "unc_threads:read" in p %}
{% set can_labels = su or "manufacturers:read" in p or "part_colours:read" in p or "part_types:read" in p or "scope_models:read" in p or "sub_part_types:read" in p %}
{% set can_database = su or "imported_parts:read" in p or "augmented_parts:read" in p %}
{% set can_parts = can_connections or can_labels or can_database %}
<header class="topbar">
<div class="brand"><a href="/">{{ app_name }}</a></div>
<nav>
<a href="/">Dashboard</a>
{% if user.is_superuser or "users:read" in user.permissions %}
<a href="/admin/users">Users</a>
{% if can_admin %}
<div class="nav-group">
<span class="nav-label">Admin ▾</span>
<div class="nav-dropdown">
{% if su or "users:read" in p %}<a href="/admin/users">Users</a>{% endif %}
{% if su or "roles:read" in p %}<a href="/admin/roles">Roles</a>{% endif %}
{% if su or "audit_log:read" in p %}<a href="/admin/audit-log">Audit Log</a>{% endif %}
</div>
</div>
{% endif %}
{% if user.is_superuser or "roles:read" in user.permissions %}
<a href="/admin/roles">Roles</a>
{% if can_parts %}
<div class="nav-group">
<span class="nav-label">Parts ▾</span>
<div class="nav-dropdown">
{% if can_connections %}
<div class="nav-group">
<span class="nav-label">Connections ▶</span>
<div class="nav-dropdown">
{% if su or "clamp_connections:read" in p %}<a href="/admin/clamp-connections">Clamp Connections</a>{% endif %}
{% if su or "iso_threads:read" in p %}<a href="/admin/iso-threads">ISO Threads</a>{% endif %}
{% if su or "static_connections:read" in p %}<a href="/admin/static-connections">Static Connections</a>{% endif %}
{% if su or "unc_threads:read" in p %}<a href="/admin/unc-threads">UNC Threads</a>{% endif %}
</div>
</div>
{% endif %}
{% if user.is_superuser or "iso_threads:read" in user.permissions %}
<a href="/admin/iso-threads">ISO Threads</a>
{% if can_labels %}
<div class="nav-group">
<span class="nav-label">Labels ▶</span>
<div class="nav-dropdown">
{% if su or "manufacturers:read" in p %}<a href="/admin/manufacturers">Manufacturers</a>{% endif %}
{% if su or "part_colours:read" in p %}<a href="/admin/part-colours">Part Colours</a>{% endif %}
{% if su or "part_types:read" in p %}<a href="/admin/part-types">Part Types</a>{% endif %}
{% if su or "scope_models:read" in p %}<a href="/admin/scope-models">Scope Models</a>{% endif %}
{% if su or "sub_part_types:read" in p %}<a href="/admin/sub-part-types">Sub Part Types</a>{% endif %}
</div>
</div>
{% endif %}
{% if user.is_superuser or "unc_threads:read" in user.permissions %}
<a href="/admin/unc-threads">UNC Threads</a>
{% if can_database %}
<div class="nav-group">
<span class="nav-label">Database ▶</span>
<div class="nav-dropdown">
{% if su or "imported_parts:read" in p %}<a href="/admin/imported-parts">Imported Parts</a>{% endif %}
{% if su or "augmented_parts:read" in p %}<a href="/admin/augmented-parts">Augmented Parts</a>{% endif %}
{% if su or "augmented_parts:write" in p %}<a href="/admin/augmented-parts/skipped">Skipped Parts</a>{% endif %}
</div>
</div>
{% endif %}
{% if user.is_superuser or "manufacturers:read" in user.permissions %}
<a href="/admin/manufacturers">Manufacturers</a>
{% endif %}
{% if user.is_superuser or "scope_models:read" in user.permissions %}
<a href="/admin/scope-models">Scope Models</a>
{% endif %}
{% if user.is_superuser or "part_types:read" in user.permissions %}
<a href="/admin/part-types">Part Types</a>
{% endif %}
{% if user.is_superuser or "sub_part_types:read" in user.permissions %}
<a href="/admin/sub-part-types">Sub Part Types</a>
{% endif %}
{% if user.is_superuser or "imported_parts:read" in user.permissions %}
<a href="/admin/imported-parts">Imported Parts</a>
{% endif %}
{% if user.is_superuser or "augmented_parts:read" in user.permissions %}
<a href="/admin/augmented-parts">Augmented Parts</a>
{% endif %}
{% if user.is_superuser or "augmented_parts:write" in user.permissions %}
<a href="/admin/augmented-parts/skipped">Skipped Parts</a>
{% endif %}
{% if user.is_superuser or "part_colours:read" in user.permissions %}
<a href="/admin/part-colours">Part Colours</a>
{% endif %}
{% if user.is_superuser or "static_connections:read" in user.permissions %}
<a href="/admin/static-connections">Static Connections</a>
{% endif %}
{% if user.is_superuser or "clamp_connections:read" in user.permissions %}
<a href="/admin/clamp-connections">Clamp Connections</a>
{% endif %}
{% if user.is_superuser or "audit_log:read" in user.permissions %}
<a href="/admin/audit-log">Audit Log</a>
</div>
</div>
{% endif %}
<a href="/docs" target="_blank">API docs</a>
</nav>
<form method="post" action="/logout" class="logout">