View Source LiveAdmin.Resource (LiveAdmin v0.11.2)
API for managing Ecto schemas and their individual record instances used internally by LiveAdmin.
use LiveAdmin.ResourceThis is required in any module that should act as a LiveAdmin Resource. If the module is not an Ecto schema, then the
:schemaoption must be passed. Using this module will create a live_admin_config module variable and 2 functions to query it, live_admin_config/0 and live_admin_config/1. The former returns the entire config while the latter will return a key if it exists, otherwise it will fallback to either a global config for that key, or the key's default value.
To customize UI behavior, the following options may also be used:
title_with- a binary, or MFA that returns a binary, used to identify the resourcelabel_with- a binary, or MFA that returns a binary, used to identify recordslist_with- an atom or MFA that identifies the function that implements listing the resourcecreate_with- an atom or MFA that identifies the function that implements creating the resource (set to false to disable create)update_with- an atom or MFA that identifies the function that implements updating a record (set to false to disable update)delete_with- an atom or MFA that identifies the function that implements deleting a record (set to false to disable delete)validate_with- an atom or MFA that identifies the function that implements validating a changed recordrender_with- an atom or MFA that identifies the function that implements table field rendering logichidden_fields- a list of fields that should not be displayed in the UIimmutable_fields- a list of fields that should not be editable in formsactions- list of atoms or MFAs that identify a function that operates on a recordtasks- list atoms or MFAs that identify a function that operates on a resourcecomponents- keyword list of component module overrides for specific views (:list,:new,:edit,:home,:nav,:session,:view)ecto_repo- Ecto repo to use when building queries for this resource