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/map" class="btn btn-ghost btn-sm">Contact Map</.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}
|
||||
navigate="/users"
|
||||
class="btn btn-ghost btn-sm"
|
||||
class="dropdown dropdown-end"
|
||||
>
|
||||
Users
|
||||
</.link>
|
||||
<.link
|
||||
:if={@current_scope && @current_scope.user && @current_scope.user.is_admin}
|
||||
navigate="/admin/contact-edits"
|
||||
class="btn btn-ghost btn-sm"
|
||||
>
|
||||
Edits
|
||||
</.link>
|
||||
<.link
|
||||
:if={@current_scope && @current_scope.user && @current_scope.user.is_admin}
|
||||
href="/admin/oban"
|
||||
class="btn btn-ghost btn-sm"
|
||||
>
|
||||
Oban
|
||||
</.link>
|
||||
<div tabindex="0" role="button" class="btn btn-ghost btn-sm">
|
||||
Admin <.icon name="hero-chevron-down-micro" class="size-3" />
|
||||
</div>
|
||||
<ul
|
||||
tabindex="0"
|
||||
class="dropdown-content menu bg-base-100 rounded-box z-[1] w-44 p-2 shadow-lg"
|
||||
>
|
||||
<li><.link navigate="/users">Users</.link></li>
|
||||
<li><.link navigate="/admin/contact-edits">Contact edits</.link></li>
|
||||
<li><.link href="/admin/oban">Oban</.link></li>
|
||||
</ul>
|
||||
</div>
|
||||
<%= if @current_scope && @current_scope.user do %>
|
||||
<.link
|
||||
navigate={~p"/u/#{@current_scope.user.callsign}"}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue