Phoenix LiveView dashboard for the attached file-attachment library.
Provides a mounted dashboard for inspecting originals, variants, and orphans in a running application.
Setup
Add the router macro to your application's router:
# router.ex
import AttachedDashboard.Web.Router
scope "/" do
pipe_through :browser
attached_dashboard "/admin/files"
endAuthentication
The dashboard does not handle authentication itself. Mount it inside a
live_session with your own on_mount hook, or pass :on_mount directly:
attached_dashboard "/admin/files", on_mount: MyApp.RequireAdminYour on_mount hook can halt and redirect unauthenticated users as usual:
def on_mount(:default, _params, session, socket) do
if session["current_user_admin?"] do
{:cont, socket}
else
{:halt, Phoenix.LiveView.redirect(socket, to: "/login")}
end
endOptions
:on_mount—on_mounthooks added to the dashboard'slive_session.:as— override the route name; defaults to:attached_dashboard.:csp_nonce_assign_key— CSP nonce key (atom or map) pulled from conn assigns.