defmodule <%= inspect context.web_module %>.LiveHelpers do import Phoenix.LiveView import Phoenix.LiveView.Helpers alias Phoenix.LiveView.JS @doc """ Renders a live component inside a modal. The rendered modal receives a `:return_to` option to properly update the URL when the modal is closed. ## Examples <.modal return_to={Routes.<%= schema.singular %>_index_path(@socket, :index)}> <.live_component module={<%= inspect context.web_module %>.<%= inspect Module.concat(schema.web_namespace, schema.alias) %>Live.FormComponent} id={@<%= schema.singular %>.id || :new} title={@page_title} action={@live_action} return_to={Routes.<%= schema.singular %>_index_path(@socket, :index)} <%= schema.singular %>: @<%= schema.singular %> /> """ def modal(assigns) do assigns = assign_new(assigns, :return_to, fn -> nil end) ~H"""