Aurora.Uix.Templates.Basic.Actions.Index (Aurora UIX v0.1.0)

Renders default row and header action links (show, edit, delete, new) for entities in index layouts.

Key Features

  • Provides LiveView-compatible components for "show", "edit", "delete", and "new" actions
  • Generates links using assigns context for entity and module information
  • Supplies helpers to add all default row and header actions to assigns
  • Supports dynamic modification of actions via layout tree options
  • Includes responsive pagination controls with multiple breakpoints
  • Offers filter management actions (clear/submit)

Key Constraints

  • Assumes assigns contain :auix with required subkeys:
    • :row_info - Entity row information
    • :source - Data source identifier
    • :module - Context module name
  • Only intended for use in index page layouts
  • Pagination requires specific assigns structure

Summary

Functions

Renders a button to clear all applied filters in the index layout.

Renders the "edit" action link for an entity in the index layout.

Renders the "new" action link for the header in the index layout.

Renders pagination controls for the index layout.

Renders the "delete" action link for an entity in the index layout.

Renders a button to select all items.

Renders a button to delete the selected items.

Renders a button to unselect all items.

Sets up actions for the index layout by adding defaults and applying modifications.

Renders the "show" action link for an entity in the index layout.

Renders a button to submit current filter selections in the index layout.

Renders a open filters or close filters buttons.

Renders checkbox to toggle selection of all rows in index layout.

Functions

clear_filters_action(assigns)

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

Renders a button to clear all applied filters in the index layout.

Parameters

  • assigns (map()) - Assigns map (no specific requirements)

Returns

Rendered.t() - Button that triggers "filters-clear" event

Notes

  • Uses predefined button styling from module attribute @filters_button_class

edit_row_action(assigns)

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

Renders the "edit" action link for an entity in the index layout.

Parameters

  • assigns (map()) - Assigns map containing:
    • :auix (map()) - Required context with:
      • :row_info (tuple()) - Entity row information
      • :module (atom()) - Context module name

Returns

Rendered.t() - The rendered "edit" action link

new_header_action(assigns)

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

Renders the "new" action link for the header in the index layout.

Parameters

  • assigns (map()) - Assigns map containing:
    • :auix (map()) - Required context with:
      • :index_new_link (binary()) - Path for new entity creation
      • :module (atom()) - Context module name
      • :name (binary()) - Display name for the entity type

Returns

Rendered.t() - Button link for creating new entities

pagination_action(assigns)

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

Renders pagination controls for the index layout.

Parameters

  • assigns (map()) - Assigns map containing:
    • :auix (map()) - Required context with:
      • :layout_options (map()) - Must contain:
        • :pagination_disabled? (boolean()) - False to enable
        • :pages_bar_range_offset (function()) - Breakpoint sizing function
      • :pagination (map()) - Must contain:
        • :page (integer()) - Current page
        • :pages_count (integer()) - Total pages (>1 to render)
      • :source (binary()) - Data source identifier

Returns

Rendered.t() - Responsive pagination controls or empty fragment

Breakpoints

  • Renders different pagination ranges for:
    • xl2 (2xl): widest range
    • xl: medium range
    • lg: smaller range
    • md: minimal range
    • sm: mobile-optimized

remove_row_action(assigns)

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

Renders the "delete" action link for an entity in the index layout.

Parameters

  • assigns (map()) - Assigns map containing:
    • :auix (map()) - Required context with:
      • :row_info (tuple()) - Entity row information
      • :module (atom()) - Context module name

Returns

Rendered.t() - The rendered "delete" action link with confirmation

Edge Cases

  • If @auix.row_info is missing or malformed, returns malformed link

selected_check_all_action(assigns)

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

Renders a button to select all items.

Parameters

  • assigns (map()) - Assigns map.

Returns

Rendered.t() - Button that triggers the event

selected_delete_all_action(assigns)

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

Renders a button to delete the selected items.

Parameters

  • assigns (map()) - Assigns map.

Returns

Rendered.t() - Button that triggers the event

selected_uncheck_all_action(assigns)

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

Renders a button to unselect all items.

Parameters

  • assigns (map()) - Assigns map.

Returns

Rendered.t() - Button that triggers the event

set_actions(socket)

Sets up actions for the index layout by adding defaults and applying modifications.

Parameters

  • socket (Socket.t()) - LiveView socket containing the layout state

Returns

Socket.t() - The updated socket with all default actions configured

show_row_action(assigns)

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

Renders the "show" action link for an entity in the index layout.

Parameters

  • assigns (map()) - Assigns map containing:
    • :auix (map()) - Required context with:
      • :row_info (tuple()) - Entity row information
      • :module (atom()) - Context module name

Returns

Rendered.t() - The rendered "edit" action link

submit_filters_action(assigns)

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

Renders a button to submit current filter selections in the index layout.

Parameters

  • assigns (map()) - Assigns map (no specific requirements)

Returns

Rendered.t() - Button that triggers "filters-submit" event

Notes

  • Uses predefined button styling from module attribute @filters_button_class

toggle_filters_action(assigns)

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

Renders a open filters or close filters buttons.

Parameters

  • assigns (map()) - Assigns map containing:

Returns

Rendered.t() - Button link for creating new entities

toggle_selected_all_in_page_action(assigns)

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

Renders checkbox to toggle selection of all rows in index layout.

Parameters

  • assigns (map()) - Assigns map containing:
    • :auix (map()) - Required context with:
      • :selection (map()) - Current selection states for the page

Returns

Rendered.t() - Checkbox input that triggers "selected-toggle-all" event