You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/live_admin.ex
+31-15Lines changed: 31 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -2,13 +2,14 @@ defmodule LiveAdmin do
2
2
@moduledocdocout: [LiveAdmin.READMECompiler]
3
3
4
4
@typemod_func::{module(),:atom}
5
-
@typefunc_ref:::atom|mod_func()|:mfa
5
+
@typefunc_ref::atom()|mod_func()
6
6
@typefunc_list::[func_ref]|keyword(func_ref)
7
7
@typefield_list::[:atom]
8
8
9
9
@options_schema[
10
10
components: [
11
11
type: :non_empty_keyword_list,
12
+
doc: "Overrides portions of the UI with custom LiveComponent modules.",
12
13
type_doc: "list of modules implementing LiveComponent overrides of LiveAdmin views",
13
14
keys: [
14
15
nav: [type: :atom],
@@ -22,49 +23,60 @@ defmodule LiveAdmin do
22
23
],
23
24
ecto_repo: [
24
25
type: :atom,
26
+
doc: "Required. Must be set at the application or scope level.",
25
27
type_doc: "Ecto Repo used to query resource"
26
28
],
27
29
query_with: [
28
30
type: {:or,[:atom,{:tuple,[:atom,:atom]}]},
31
+
doc: "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.",
29
32
type_doc: "`t:func_ref/0` returning an Ecto queryable"
30
33
],
31
34
render_with: [
32
35
type: {:or,[:atom,{:tuple,[:atom,:atom]}]},
36
+
doc: "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.",
33
37
type_doc: "`t:func_ref/0` used to convert field values to strings when rendering"
34
38
],
35
39
delete_with: [
36
-
type: {:or,[:atom,{:tuple,[:atom,:atom]}]},
37
-
type_doc: "`t:func_ref/0` or `false` to disable deleting records"
doc: "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`.",
47
+
type_doc: "`t:func_ref/0` or `false`"
42
48
],
43
49
update_with: [
44
-
type: {:or,[:atom,{:tuple,[:atom,:atom]}]},
45
-
type_doc: "`t:func_ref/0` or `false` to disable updating records"
doc: "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`.",
52
+
type_doc: "`t:func_ref/0` or `false`"
46
53
],
47
54
validate_with: [
48
55
type: {:or,[:atom,{:tuple,[:atom,:atom]}]},
49
-
type_doc:
50
-
"`t:func_ref/0` used to validate create/update changesets in LiveAdmin :form component"
56
+
doc: "Customizes how changesets are validated in create/update forms. When not set, no additional validation is applied.",
57
+
type_doc: "`t:func_ref/0`"
51
58
],
52
59
label_with: [
53
60
type: {:or,[:atom,{:tuple,[:atom,:atom]}]},
54
-
type_doc:
55
-
"`t:func_ref/0` used to convert (association) record to string in LiveAdmin SearchSelect component"
61
+
doc: "Customizes how records are identified in the UI. When not set, uses the primary key.",
62
+
type_doc: "`t:func_ref/0`"
56
63
],
57
64
title_with: [
58
65
type: {:or,[:string,{:tuple,[:atom,:atom]}]},
59
-
type_doc: "string literal or MFA returning a string used to render LiveAdmin UI heading"
66
+
doc: "Customizes the heading displayed for a resource. When not set, uses the schema module name.",
67
+
type_doc: "string literal or `t:func_ref/0`"
60
68
],
61
69
hidden_fields: [
62
70
type: {:list,:atom},
63
-
type_doc: "`t:field_list/0` to be hidden from LiveView"
71
+
default: [],
72
+
doc: "Specifies fields to hide from all views.",
73
+
type_doc: "`t:field_list/0`"
64
74
],
65
75
immutable_fields: [
66
76
type: {:list,:atom},
67
-
type_doc: "`t:field_list/0` to be disabled in LiveAdmin :form component"
77
+
default: [],
78
+
doc: "Specifies fields to disable in create/update forms.",
doc: "Defines functions that operate on a resource as a whole.",
93
109
type_doc:
94
-
"`t:func_list/0` taking a query, LiveAdmin session and any extra args. The query will include any search conditions limiting results, but not pagination or order"
110
+
"`t:func_list/0` taking a query, LiveAdmin session, and any extra args"
0 commit comments