actions do
action :retry, type: :single, enabled: true, handler: &__MODULE__.retry/2
end
def retry(socket, id) do
...
socket
end
There are two types of action available, Single actions that appear
within each row, and Page actions that appear at the top right corner
of the page.
Both actions need a handler that takes in 2-arity, and must return a
socket (you can do whatever you want in this socket, like push_patch
etc). The first argument to the handler function is socket, the second
argument is the id, or nil in case of page actions (down the road
we might pass down a list of ids for page actions).
This commit also (in a very hackish way) hide the create/edit button
if you haven't defined the corresponding routes for them.
Use the
actions
macro like so:There are two types of
action
available,Single
actions that appear within each row, andPage
actions that appear at the top right corner of the page.Both actions need a handler that takes in 2-arity, and must return a socket (you can do whatever you want in this socket, like
push_patch
etc). The first argument to the handler function is socket, the second argument is theid
, ornil
in case of page actions (down the road we might pass down a list of ids for page actions).This commit also (in a very hackish way) hide the
create
/edit
button if you haven't defined the corresponding routes for them.