View Source LiveAdmin.Router (LiveAdmin v0.11.5)

Link to this section Summary

Functions

Defines a resource to be included in a LiveAdmin UI.

Defines a group of LiveAdmin resources that share a common path prefix, and optionally, configuration.

Link to this section Functions

Link to this macro

admin_resource(path, resource_mod)

View Source (macro)

Defines a resource to be included in a LiveAdmin UI.

For each configured resource at path /foo, the following routes will be added:

  • /foo - List view
  • /foo/new - New record form
  • /foo/:id/edit - Update record form
Link to this function

build_session(conn, base_path, title, components, repo, on_mount)

View Source
Link to this macro

live_admin(path, opts \\ [], list)

View Source (macro)

Defines a group of LiveAdmin resources that share a common path prefix, and optionally, configuration.

arguments

Arguments

  • path - Defines a scope to be added to the router under which the resources will be grouped in a single live session
  • opts - Opts for the Admin UI added at configured path
    • :title - Title for the UI home view (Default: 'LiveAdmin')
    • :components - Component overrides that will be used for every resource in the group unless a resource is configurated to use its own overrides.
    • :repo - An Ecto repo to use for queries within this group of admin resources, unless overriden by an individual resource
    • on_mount - A Tuple identifying a function with arity 1, that will be passed the socket and should return it
Link to this function

on_mount(atom, params, map, socket)

View Source