Aurora.Uix.Templates.Basic.Actions.OneToMany (Aurora UIX v0.1.4-rc.2)

Copy Markdown

Provides helpers for managing one-to-many association actions in Aurora UIX index layouts.

This module sets up and modifies actions for header, footer, and row elements in index layouts that represent one-to-many associations. It ensures that default actions are present and allows for further customization via the Actions.modify_actions/2 function.

Key Features

  • Adds default actions for headers, footers, and rows in one-to-many association tables.
  • Integrates with the Aurora UIX action modification pipeline.
  • Provides helpers for rendering "new", "show", "edit", and "delete" child links in form layouts.

Key Constraints

  • Expects the assigns map to include an :auix key with required subkeys for actions.
  • Designed for use within Phoenix LiveView templates and Aurora UIX layouts.

Summary

Functions

Renders a link for adding a new child entity in a one-to-many association form.

Renders a link for deleting a child entity in a one-to-many association.

Renders a link for editing a child entity in a one-to-many association.

Sets up actions for the one-to-many field rendering layout by adding defaults and applying modifications.

Renders a link for showing a child entity in a one-to-many association.

Functions

add_new_child(assigns)

@spec add_new_child(map()) :: Phoenix.LiveView.Rendered.t()

Renders a link for adding a new child entity in a one-to-many association form.

The link is only shown if the index new link is enabled, the layout type is :form, and the parent entity has a non-nil ID.

Parameters

  • assigns (map()) - Assigns map containing association and entity context.
    • Must include :auix key with :association, :entity, :layout_type, and :field.

Returns

Phoenix.LiveView.Rendered.t() - Rendered link component.

delete_child_action(assigns)

@spec delete_child_action(map()) :: Phoenix.LiveView.Rendered.t()

Renders a link for deleting a child entity in a one-to-many association.

Parameters

  • assigns (map()) - Assigns map containing association and row info.

Returns

Phoenix.LiveView.Rendered.t() - Rendered link component.

edit_child_action(assigns)

@spec edit_child_action(map()) :: Phoenix.LiveView.Rendered.t()

Renders a link for editing a child entity in a one-to-many association.

Parameters

  • assigns (map()) - Assigns map containing association and row info.

Returns

Phoenix.LiveView.Rendered.t() - Rendered link component.

set_actions(assigns)

@spec set_actions(map()) :: map()

Sets up actions for the one-to-many field rendering layout by adding defaults and applying modifications.

Parameters

  • assigns (map()) - Assigns map containing the layout tree and context.
    • Must include :auix key with required subkeys.

Returns

map() - The updated assigns with actions set.

show_child_action(assigns)

@spec show_child_action(map()) :: Phoenix.LiveView.Rendered.t()

Renders a link for showing a child entity in a one-to-many association.

Parameters

  • assigns (map()) - Assigns map containing association and row info.

Returns

Phoenix.LiveView.Rendered.t() - Rendered link component.