View Source LiveAdmin (LiveAdmin v1.0.0-rc.3)

Link to this section Summary

Link to this section Types

Specs

field_list() :: [:atom]

Specs

func_list() :: [func_ref()] | keyword(func_ref())

Specs

func_ref() :: atom() | mod_func()

Specs

mod_func() :: {module(), :atom}

Link to this section Functions

Link to this function

announce(message, type, session)

View Source
Link to this function

associated_resource(schema, field_name, resources, part \\ nil)

View Source

Defines NimbleOptions schema for configuration that can be set at all levels (resource, scope, and application).

Used internally to validate configuration in apps using LiveAdmin.

Supported options:

  • :components (list of modules implementing LiveComponent overrides of LiveAdmin views) - Overrides portions of the UI with custom LiveComponent modules.

  • :ecto_repo (Ecto Repo used to query resource) - Required. Must be set at the application or scope level.

  • :query_with (func_ref/0 returning an Ecto queryable) - Customizes how records are fetched. Receives the resource and search term and should return an Ecto queryable. Useful for adding preloads or custom search logic. When not set, uses the schema with built-in search.

  • :render_with (func_ref/0 used to convert field values to strings when rendering) - Customizes how field values are displayed. Receives the record, field name, and session. Should return a string or Phoenix.HTML.Safe value to render HTML. When not set, uses built-in type-based rendering.

  • :delete_with (func_ref/0 or false) - Customizes how records are deleted. Can be set to false to disable. When not set, uses Repo.delete.

  • :create_with (func_ref/0 or false) - Customizes how records are created. Can be set to false to disable. When not set, builds a changeset that casts all fields with no validations and calls Repo.insert.

  • :update_with (func_ref/0 or false) - Customizes how records are updated. Can be set to false to disable. When not set, builds a changeset that casts all fields with no validations and calls Repo.update.

  • :validate_with (func_ref/0) - Customizes how changesets are validated in create/update forms. When not set, no additional validation is applied.

  • :label_with (func_ref/0) - Customizes how records are identified in the UI. When not set, uses the primary key.

  • :title_with (string literal or func_ref/0) - Customizes the heading displayed for a resource. When not set, uses the schema module name.

  • :hidden_fields (field_list/0) - Specifies fields to hide from all views. When not set at the resource level, falls back to scope or global config (default: []).

  • :immutable_fields (field_list/0) - Specifies fields to disable in create/update forms. When not set at the resource level, falls back to scope or global config (default: []).

  • :actions (func_list/0 taking a record, LiveAdmin session struct, and any extra args) - Defines functions that operate on a specific record. When not set at the resource level, falls back to scope or global config (default: []).

  • :tasks (func_list/0 taking a query, LiveAdmin session, and any extra args) - Defines functions that operate on a resource as a whole. When not set at the resource level, falls back to scope or global config (default: []).

Link to this function

extract_function_docs(module, function)

View Source
Link to this function

fetch_config(resource, key, config)

View Source
Link to this function

fetch_function(resource, config, function_type, function)

View Source
Link to this function

parent_associations(schema)

View Source
Link to this function

record_label(record, resource, config)

View Source
Link to this function

resource_title(resource, session)

View Source
Link to this function

resources(router, base_path)

View Source
Link to this function

route_with_params(assigns, parts \\ [])

View Source
Link to this function

trans(string, opts \\ [])

View Source