Relayout of nav
This commit is contained in:
1 parent
59184124e7
commit
7fcf5b3f75
2 files changed
+133
-43
No files matched your search
@@ -57,6 +57,7 @@ a:hover {
|
|||||||
|
|
||||||
.topbar nav {
|
.topbar nav {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,6 +68,76 @@ a:hover {
|
|||||||
gap: 0.75rem;
|
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 */
|
/* Cards */
|
||||||
.card {
|
.card {
|
||||||
background: var(--surface);
|
background: var(--surface);
|
||||||
|
|||||||
+62
-43
@@ -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">
|
<header class="topbar">
|
||||||
<div class="brand"><a href="/">{{ app_name }}</a></div>
|
<div class="brand"><a href="/">{{ app_name }}</a></div>
|
||||||
<nav>
|
<nav>
|
||||||
<a href="/">Dashboard</a>
|
<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 %}
|
{% endif %}
|
||||||
{% if user.is_superuser or "roles:read" in user.permissions %}
|
|
||||||
<a href="/admin/roles">Roles</a>
|
{% if can_parts %}
|
||||||
{% endif %}
|
<div class="nav-group">
|
||||||
{% if user.is_superuser or "iso_threads:read" in user.permissions %}
|
<span class="nav-label">Parts ▾</span>
|
||||||
<a href="/admin/iso-threads">ISO Threads</a>
|
<div class="nav-dropdown">
|
||||||
{% endif %}
|
|
||||||
{% if user.is_superuser or "unc_threads:read" in user.permissions %}
|
{% if can_connections %}
|
||||||
<a href="/admin/unc-threads">UNC Threads</a>
|
<div class="nav-group">
|
||||||
{% endif %}
|
<span class="nav-label">Connections ▶</span>
|
||||||
{% if user.is_superuser or "manufacturers:read" in user.permissions %}
|
<div class="nav-dropdown">
|
||||||
<a href="/admin/manufacturers">Manufacturers</a>
|
{% if su or "clamp_connections:read" in p %}<a href="/admin/clamp-connections">Clamp Connections</a>{% endif %}
|
||||||
{% endif %}
|
{% if su or "iso_threads:read" in p %}<a href="/admin/iso-threads">ISO Threads</a>{% endif %}
|
||||||
{% if user.is_superuser or "scope_models:read" in user.permissions %}
|
{% if su or "static_connections:read" in p %}<a href="/admin/static-connections">Static Connections</a>{% endif %}
|
||||||
<a href="/admin/scope-models">Scope Models</a>
|
{% if su or "unc_threads:read" in p %}<a href="/admin/unc-threads">UNC Threads</a>{% endif %}
|
||||||
{% endif %}
|
</div>
|
||||||
{% if user.is_superuser or "part_types:read" in user.permissions %}
|
</div>
|
||||||
<a href="/admin/part-types">Part Types</a>
|
{% endif %}
|
||||||
{% endif %}
|
|
||||||
{% if user.is_superuser or "sub_part_types:read" in user.permissions %}
|
{% if can_labels %}
|
||||||
<a href="/admin/sub-part-types">Sub Part Types</a>
|
<div class="nav-group">
|
||||||
{% endif %}
|
<span class="nav-label">Labels ▶</span>
|
||||||
{% if user.is_superuser or "imported_parts:read" in user.permissions %}
|
<div class="nav-dropdown">
|
||||||
<a href="/admin/imported-parts">Imported Parts</a>
|
{% if su or "manufacturers:read" in p %}<a href="/admin/manufacturers">Manufacturers</a>{% endif %}
|
||||||
{% endif %}
|
{% if su or "part_colours:read" in p %}<a href="/admin/part-colours">Part Colours</a>{% endif %}
|
||||||
{% if user.is_superuser or "augmented_parts:read" in user.permissions %}
|
{% if su or "part_types:read" in p %}<a href="/admin/part-types">Part Types</a>{% endif %}
|
||||||
<a href="/admin/augmented-parts">Augmented Parts</a>
|
{% if su or "scope_models:read" in p %}<a href="/admin/scope-models">Scope Models</a>{% endif %}
|
||||||
{% endif %}
|
{% if su or "sub_part_types:read" in p %}<a href="/admin/sub-part-types">Sub Part Types</a>{% endif %}
|
||||||
{% if user.is_superuser or "augmented_parts:write" in user.permissions %}
|
</div>
|
||||||
<a href="/admin/augmented-parts/skipped">Skipped Parts</a>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if user.is_superuser or "part_colours:read" in user.permissions %}
|
|
||||||
<a href="/admin/part-colours">Part Colours</a>
|
{% if can_database %}
|
||||||
{% endif %}
|
<div class="nav-group">
|
||||||
{% if user.is_superuser or "static_connections:read" in user.permissions %}
|
<span class="nav-label">Database ▶</span>
|
||||||
<a href="/admin/static-connections">Static Connections</a>
|
<div class="nav-dropdown">
|
||||||
{% endif %}
|
{% if su or "imported_parts:read" in p %}<a href="/admin/imported-parts">Imported Parts</a>{% endif %}
|
||||||
{% if user.is_superuser or "clamp_connections:read" in user.permissions %}
|
{% if su or "augmented_parts:read" in p %}<a href="/admin/augmented-parts">Augmented Parts</a>{% endif %}
|
||||||
<a href="/admin/clamp-connections">Clamp Connections</a>
|
{% if su or "augmented_parts:write" in p %}<a href="/admin/augmented-parts/skipped">Skipped Parts</a>{% endif %}
|
||||||
{% endif %}
|
</div>
|
||||||
{% if user.is_superuser or "audit_log:read" in user.permissions %}
|
</div>
|
||||||
<a href="/admin/audit-log">Audit Log</a>
|
{% endif %}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<a href="/docs" target="_blank">API docs</a>
|
<a href="/docs" target="_blank">API docs</a>
|
||||||
</nav>
|
</nav>
|
||||||
<form method="post" action="/logout" class="logout">
|
<form method="post" action="/logout" class="logout">
|
||||||
|
|||||||
Reference in new issue
Block a user