PhoenixKitWeb.AdminEditHelper (phoenix_kit v1.7.103)

Copy Markdown View Source

Universal admin edit URL helper. Assigns admin_edit_url and admin_edit_label to conn/socket if user is admin. Works with both Plug.Conn (controllers) and Phoenix.LiveView.Socket (LiveViews).

Summary

Functions

Assigns :admin_edit_url and :admin_edit_label if the current user is an admin. Returns conn/socket unchanged for non-admins or unauthenticated users.

Functions

assign_admin_edit(conn_or_socket, path, label \\ "Edit")

Assigns :admin_edit_url and :admin_edit_label if the current user is an admin. Returns conn/socket unchanged for non-admins or unauthenticated users.