mirror of
https://github.com/ash-project/ash_phoenix.git
synced 2024-09-19 23:02:48 +12:00
parent
d24129e270
commit
6d68aa3471
1 changed files with 16 additions and 2 deletions
|
@ -2168,10 +2168,24 @@ defmodule AshPhoenix.Form do
|
||||||
|
|
||||||
This can be useful if you have a button that should modify a nested form in some way, for example.
|
This can be useful if you have a button that should modify a nested form in some way, for example.
|
||||||
"""
|
"""
|
||||||
@spec update_form(t(), path(), (t() -> t())) :: t()
|
@spec update_form(
|
||||||
@spec update_form(Phoenix.HTML.Form.t(), path(), (t() -> t())) :: Phoenix.HTML.Form.t()
|
t(),
|
||||||
|
list(atom | integer) | String.t() | atom,
|
||||||
|
(t() -> t()) | ([t()] -> [t()])
|
||||||
|
) ::
|
||||||
|
t()
|
||||||
|
@spec update_form(
|
||||||
|
Phoenix.HTML.Form.t(),
|
||||||
|
list(atom | integer) | String.t(),
|
||||||
|
(t() -> t()) | ([t()] -> [t()])
|
||||||
|
) ::
|
||||||
|
Phoenix.HTML.Form.t()
|
||||||
def update_form(form, path, func, opts \\ [])
|
def update_form(form, path, func, opts \\ [])
|
||||||
|
|
||||||
|
def update_form(form, path, func, opts) when is_atom(path) do
|
||||||
|
update_form(form, [path], func, opts)
|
||||||
|
end
|
||||||
|
|
||||||
def update_form(%Phoenix.HTML.Form{} = form, path, func, opts) do
|
def update_form(%Phoenix.HTML.Form{} = form, path, func, opts) do
|
||||||
form.source
|
form.source
|
||||||
|> update_form(path, func, opts)
|
|> update_form(path, func, opts)
|
||||||
|
|
Loading…
Reference in a new issue