From 69504a52ed41a093a7dc4079e6f24f0c9a2e5c0e Mon Sep 17 00:00:00 2001 From: Chulki Lee Date: Sun, 6 Aug 2023 00:42:22 -0700 Subject: [PATCH] assign generated id --- installer/templates/phx_web/components/core_components.ex | 3 ++- priv/templates/phx.gen.live/core_components.ex | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/installer/templates/phx_web/components/core_components.ex b/installer/templates/phx_web/components/core_components.ex index 2fe64b24b3..b91fbd2ff8 100644 --- a/installer/templates/phx_web/components/core_components.ex +++ b/installer/templates/phx_web/components/core_components.ex @@ -106,10 +106,11 @@ defmodule <%= @web_namespace %>.CoreComponents do slot :inner_block, doc: "the optional inner block that renders the flash message" def flash(assigns) do + assigns = assign(assigns, :id, assigns.id || "flash-#{assigns.kind}") ~H"""
hide("##{@id}")} role="alert" class={[ diff --git a/priv/templates/phx.gen.live/core_components.ex b/priv/templates/phx.gen.live/core_components.ex index 2fe64b24b3..b91fbd2ff8 100644 --- a/priv/templates/phx.gen.live/core_components.ex +++ b/priv/templates/phx.gen.live/core_components.ex @@ -106,10 +106,11 @@ defmodule <%= @web_namespace %>.CoreComponents do slot :inner_block, doc: "the optional inner block that renders the flash message" def flash(assigns) do + assigns = assign(assigns, :id, assigns.id || "flash-#{assigns.kind}") ~H"""
hide("##{@id}")} role="alert" class={[