PhoenixKitWeb.Components.Core.AdminEditLink (phoenix_kit v2.22.2)

Copy Markdown View Source

Renders the "Edit" link a host drops into a public page's layout to reach the matching admin page.

Reads plain assigns — no scope check happens here. The gate lives in PhoenixKitWeb.AdminEditHelper.assign_admin_edit/3, the producer that sets :admin_edit_url/:admin_edit_label; this component only decides how to render them, and renders nothing when :url is nil (unauthenticated visitor, non-admin, or a page nobody called the producer for).

Examples

<.admin_edit_link url={assigns[:admin_edit_url]} label={assigns[:admin_edit_label]} />

<.admin_edit_link
  url={assigns[:admin_edit_url]}
  label={assigns[:admin_edit_label]}
  variant={:menu_item}
/>

Summary

Functions

Renders an edit link into the matching admin page.

Functions

admin_edit_link(assigns)

Renders an edit link into the matching admin page.

Attributes

  • :url — the admin page path. Renders nothing when nil (default).
  • :label — link text. Defaults to gettext "Edit" when nil.
  • :variant:button (default, a standalone outlined button) or :menu_item (a daisyUI menu <li>, for dropdowns like PhoenixKitWeb.Components.UserDashboardNav.user_dropdown/1).
  • :class — extra classes appended to the variant's base classes.
  • :rest — passed through to the underlying <.link>.

Attributes

  • url (:string) - Defaults to nil.
  • label (:string) - Defaults to nil.
  • variant (:atom) - Defaults to :button. Must be one of :button, or :menu_item.
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.