MishkaCmsCoreWeb.TableActions.Fork (Mishka CMS Core v0.0.1)

Copy Markdown View Source

A row action that copies a record and leaves the original alone — Gervaz's ActionType behaviour rather than a custom event.

Every other control on a drafts row is a built-in: :destroy deletes, the row click opens. Forking has no built-in equivalent, and the honest way to add one is a type the table understands, not an escape hatch that routes around it. Declared like any other:

row_actions do
  action :fork, type: MishkaCmsCoreWeb.TableActions.Fork
end

It pushes Gervaz's own row_action event, so the table's before/after hooks, its confirm handling and its authorization checks all apply exactly as they do to a built-in. What the fork means — copy this draft's template under a free name — belongs to the resource's after_row_action hook, not here; this module only draws the control and names the event.

See MishkaGervaz.Table.Behaviours.ActionType for what may go in the assigns map, and MishkaGervaz.Table.Types.Action.Unarchive for the shape this follows.