defmodule AggieditWeb.LiveHelpers do import Phoenix.LiveView import Phoenix.LiveView.Helpers alias Phoenix.LiveView.JS alias Aggiedit.Accounts alias Aggiedit.Accounts.User alias Aggiedit.Rooms alias Aggiedit.Roles alias AggieditWeb.Router.Helpers, as: Routes @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.post_index_path(@socket, :index)}> <.live_component module={AggieditWeb.PostLive.FormComponent} id={@post.id || :new} title={@page_title} action={@live_action} return_to={Routes.post_index_path(@socket, :index)} post: @post /> """ def modal(assigns) do assigns = assign_new(assigns, :return_to, fn -> nil end) ~H"""