Admin-only nav dropdown
Collapse the three admin-only links (Users, Contact edits, Oban) into a single "Admin" dropdown in the horizontal nav so the top bar isn't cluttered with admin controls for the one admin account. Non-admins see nothing extra.
This commit is contained in:
parent
84ef7fcd9c
commit
f3d75373dd
1 changed files with 14 additions and 19 deletions
|
|
@ -47,27 +47,22 @@ defmodule MicrowavepropWeb.Layouts do
|
||||||
<.link navigate="/contacts" class="btn btn-ghost btn-sm">Contacts</.link>
|
<.link navigate="/contacts" class="btn btn-ghost btn-sm">Contacts</.link>
|
||||||
<.link navigate="/contacts/map" class="btn btn-ghost btn-sm">Contact Map</.link>
|
<.link navigate="/contacts/map" class="btn btn-ghost btn-sm">Contact Map</.link>
|
||||||
<.link navigate="/about" class="btn btn-ghost btn-sm">About</.link>
|
<.link navigate="/about" class="btn btn-ghost btn-sm">About</.link>
|
||||||
<.link
|
<div
|
||||||
:if={@current_scope && @current_scope.user && @current_scope.user.is_admin}
|
:if={@current_scope && @current_scope.user && @current_scope.user.is_admin}
|
||||||
navigate="/users"
|
class="dropdown dropdown-end"
|
||||||
class="btn btn-ghost btn-sm"
|
|
||||||
>
|
>
|
||||||
Users
|
<div tabindex="0" role="button" class="btn btn-ghost btn-sm">
|
||||||
</.link>
|
Admin <.icon name="hero-chevron-down-micro" class="size-3" />
|
||||||
<.link
|
</div>
|
||||||
:if={@current_scope && @current_scope.user && @current_scope.user.is_admin}
|
<ul
|
||||||
navigate="/admin/contact-edits"
|
tabindex="0"
|
||||||
class="btn btn-ghost btn-sm"
|
class="dropdown-content menu bg-base-100 rounded-box z-[1] w-44 p-2 shadow-lg"
|
||||||
>
|
>
|
||||||
Edits
|
<li><.link navigate="/users">Users</.link></li>
|
||||||
</.link>
|
<li><.link navigate="/admin/contact-edits">Contact edits</.link></li>
|
||||||
<.link
|
<li><.link href="/admin/oban">Oban</.link></li>
|
||||||
:if={@current_scope && @current_scope.user && @current_scope.user.is_admin}
|
</ul>
|
||||||
href="/admin/oban"
|
</div>
|
||||||
class="btn btn-ghost btn-sm"
|
|
||||||
>
|
|
||||||
Oban
|
|
||||||
</.link>
|
|
||||||
<%= if @current_scope && @current_scope.user do %>
|
<%= if @current_scope && @current_scope.user do %>
|
||||||
<.link
|
<.link
|
||||||
navigate={~p"/u/#{@current_scope.user.callsign}"}
|
navigate={~p"/u/#{@current_scope.user.callsign}"}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue