diff --git a/guides/contexts.md b/guides/contexts.md
index 333eaa209f..84f89333c8 100644
--- a/guides/contexts.md
+++ b/guides/contexts.md
@@ -152,7 +152,7 @@ defmodule HelloWeb.ProductController do
case Catalog.create_product(product_params) do
{:ok, product} ->
conn
- |> put_flash(:info, "Product created successfully.")
+ |> put_flash(:success, "Product created successfully.")
|> redirect(to: ~p"/products/#{product}")
{:error, %Ecto.Changeset{} = changeset} ->
@@ -777,7 +777,7 @@ defmodule HelloWeb.CartItemController do
case ShoppingCart.add_item_to_cart(conn.assigns.cart, product_id) do
{:ok, _item} ->
conn
- |> put_flash(:info, "Item added to your cart")
+ |> put_flash(:success, "Item added to your cart")
|> redirect(to: ~p"/cart")
{:error, _changeset} ->
@@ -1209,7 +1209,7 @@ defmodule HelloWeb.OrderController do
case Orders.complete_order(conn.assigns.cart) do
{:ok, order} ->
conn
- |> put_flash(:info, "Order created successfully.")
+ |> put_flash(:success, "Order created successfully.")
|> redirect(to: ~p"/orders/#{order}")
{:error, _reason} ->
diff --git a/guides/testing/testing_controllers.md b/guides/testing/testing_controllers.md
index b406dd1bef..be1d5cd6e5 100644
--- a/guides/testing/testing_controllers.md
+++ b/guides/testing/testing_controllers.md
@@ -73,7 +73,7 @@ def create(conn, %{"post" => post_params}) do
case Blog.create_post(post_params) do
{:ok, post} ->
conn
- |> put_flash(:info, "Post created successfully.")
+ |> put_flash(:success, "Post created successfully.")
|> redirect(to: ~p"/posts/#{post}")
{:error, %Ecto.Changeset{} = changeset} ->
@@ -142,7 +142,7 @@ def delete(conn, %{"id" => id}) do
{:ok, _post} = Blog.delete_post(post)
conn
- |> put_flash(:info, "Post deleted successfully.")
+ |> put_flash(:success, "Post deleted successfully.")
|> redirect(to: ~p"/posts")
end
```
diff --git a/installer/templates/phx_web/components/core_components.ex b/installer/templates/phx_web/components/core_components.ex
index 1aa9858b70..60954b7cf0 100644
--- a/installer/templates/phx_web/components/core_components.ex
+++ b/installer/templates/phx_web/components/core_components.ex
@@ -30,7 +30,7 @@ defmodule <%= @web_namespace %>.CoreComponents do
attr :id, :string, doc: "the optional id of flash container"
attr :flash, :map, default: %{}, doc: "the map of flash messages to display"
attr :title, :string, default: nil
- attr :kind, :atom, values: [:info, :error], doc: "used for styling and flash lookup"
+ attr :kind, :atom, values: [:info, :success, :error], doc: "used for styling and flash lookup"
attr :rest, :global, doc: "the arbitrary HTML attributes to add to the flash container"
slot :inner_block, doc: "the optional inner block that renders the flash message"
@@ -46,13 +46,15 @@ defmodule <%= @web_namespace %>.CoreComponents do
role="alert"
class={[
"fixed top-2 right-2 mr-2 w-80 sm:w-96 z-50 rounded-lg p-3 ring-1",
- @kind == :info && "bg-emerald-50 text-emerald-800 ring-emerald-500 fill-cyan-900",
+ @kind == :info && "bg-blue-50 text-blue-800 ring-blue-500 fill-blue-900",
+ @kind == :success && "bg-emerald-50 text-emerald-800 ring-emerald-500 fill-emerald-900",
@kind == :error && "bg-rose-50 text-rose-900 shadow-md ring-rose-500 fill-rose-900"
]}
{@rest}
>
<.icon :if={@kind == :info} name="hero-information-circle-mini" class="h-4 w-4" />
+ <.icon :if={@kind == :success} name="hero-information-circle-mini" class="h-4 w-4" />
<.icon :if={@kind == :error} name="hero-exclamation-circle-mini" class="h-4 w-4" />
<%%= @title %>
@@ -77,7 +79,8 @@ defmodule <%= @web_namespace %>.CoreComponents do
def flash_group(assigns) do
~H"""
- <.flash kind={:info} title=<%= maybe_heex_attr_gettext.("Success!", @gettext) %> flash={@flash} />
+ <.flash kind={:info} title=<%= maybe_heex_attr_gettext.("Please note", @gettext) %> flash={@flash} />
+ <.flash kind={:success} title=<%= maybe_heex_attr_gettext.("Success!", @gettext) %> flash={@flash} />
<.flash kind={:error} title=<%= maybe_heex_attr_gettext.("Error!", @gettext) %> flash={@flash} />
<.flash
id="client-error"
diff --git a/installer/test/phx_new_test.exs b/installer/test/phx_new_test.exs
index d33502a688..5fac19c400 100644
--- a/installer/test/phx_new_test.exs
+++ b/installer/test/phx_new_test.exs
@@ -111,7 +111,7 @@ defmodule Mix.Tasks.Phx.NewTest do
assert_file("phx_blog/lib/phx_blog_web/components/core_components.ex", fn file ->
assert file =~ "defmodule PhxBlogWeb.CoreComponents"
assert file =~ ~S|aria-label={gettext("close")}|
- assert file =~ ~S|<.flash kind={:info} title={gettext("Success!")} flash={@flash} />|
+ assert file =~ ~S|<.flash kind={:success} title={gettext("Success!")} flash={@flash} />|
end)
assert_file("phx_blog/lib/phx_blog_web/components/layouts.ex", fn file ->
@@ -567,7 +567,7 @@ defmodule Mix.Tasks.Phx.NewTest do
assert_file("phx_blog/lib/phx_blog_web/components/core_components.ex", fn file ->
assert file =~ ~S|aria-label="close"|
- assert file =~ ~S|<.flash kind={:info} title="Success!" flash={@flash} />|
+ assert file =~ ~S|<.flash kind={:success} title="Success!" flash={@flash} />|
end)
end)
end
diff --git a/priv/templates/phx.gen.auth/confirmation_controller.ex b/priv/templates/phx.gen.auth/confirmation_controller.ex
index 5a70d6e062..205a647fd1 100644
--- a/priv/templates/phx.gen.auth/confirmation_controller.ex
+++ b/priv/templates/phx.gen.auth/confirmation_controller.ex
@@ -34,7 +34,7 @@ defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web
case <%= inspect context.alias %>.confirm_<%= schema.singular %>(token) do
{:ok, _} ->
conn
- |> put_flash(:info, "<%= schema.human_singular %> confirmed successfully.")
+ |> put_flash(:success, "<%= schema.human_singular %> confirmed successfully.")
|> redirect(to: ~p"/")
:error ->
diff --git a/priv/templates/phx.gen.auth/confirmation_controller_test.exs b/priv/templates/phx.gen.auth/confirmation_controller_test.exs
index d38e11f889..492832cf9a 100644
--- a/priv/templates/phx.gen.auth/confirmation_controller_test.exs
+++ b/priv/templates/phx.gen.auth/confirmation_controller_test.exs
@@ -85,7 +85,7 @@ defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web
conn = post(conn, ~p"<%= schema.route_prefix %>/confirm/#{token}")
assert redirected_to(conn) == ~p"/"
- assert Phoenix.Flash.get(conn.assigns.flash, :info) =~
+ assert Phoenix.Flash.get(conn.assigns.flash, :success) =~
"<%= schema.human_singular %> confirmed successfully"
assert <%= inspect context.alias %>.get_<%= schema.singular %>!(<%= schema.singular %>.id).confirmed_at
diff --git a/priv/templates/phx.gen.auth/confirmation_live.ex b/priv/templates/phx.gen.auth/confirmation_live.ex
index 080ef5326b..2e4e02a674 100644
--- a/priv/templates/phx.gen.auth/confirmation_live.ex
+++ b/priv/templates/phx.gen.auth/confirmation_live.ex
@@ -35,7 +35,7 @@ defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web
{:ok, _} ->
{:noreply,
socket
- |> put_flash(:info, "<%= inspect schema.alias %> confirmed successfully.")
+ |> put_flash(:success, "<%= inspect schema.alias %> confirmed successfully.")
|> redirect(to: ~p"/")}
:error ->
diff --git a/priv/templates/phx.gen.auth/confirmation_live_test.exs b/priv/templates/phx.gen.auth/confirmation_live_test.exs
index fc31128821..53eb4c217c 100644
--- a/priv/templates/phx.gen.auth/confirmation_live_test.exs
+++ b/priv/templates/phx.gen.auth/confirmation_live_test.exs
@@ -33,7 +33,7 @@ defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web
assert {:ok, conn} = result
- assert Phoenix.Flash.get(conn.assigns.flash, :info) =~
+ assert Phoenix.Flash.get(conn.assigns.flash, :success) =~
"<%= inspect schema.alias %> confirmed successfully"
assert <%= inspect context.alias %>.get_<%= schema.singular %>!(<%= schema.singular %>.id).confirmed_at
diff --git a/priv/templates/phx.gen.auth/registration_controller.ex b/priv/templates/phx.gen.auth/registration_controller.ex
index 46752454d4..3a951c49c5 100644
--- a/priv/templates/phx.gen.auth/registration_controller.ex
+++ b/priv/templates/phx.gen.auth/registration_controller.ex
@@ -20,7 +20,7 @@ defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web
)
conn
- |> put_flash(:info, "<%= schema.human_singular %> created successfully.")
+ |> put_flash(:success, "<%= schema.human_singular %> created successfully.")
|> <%= inspect schema.alias %>Auth.log_in_<%= schema.singular %>(<%= schema.singular %>)
{:error, %Ecto.Changeset{} = changeset} ->
diff --git a/priv/templates/phx.gen.auth/reset_password_controller.ex b/priv/templates/phx.gen.auth/reset_password_controller.ex
index 5dc1c60fc0..7937ac7bad 100644
--- a/priv/templates/phx.gen.auth/reset_password_controller.ex
+++ b/priv/templates/phx.gen.auth/reset_password_controller.ex
@@ -35,7 +35,7 @@ defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web
case <%= inspect context.alias %>.reset_<%= schema.singular %>_password(conn.assigns.<%= schema.singular %>, <%= schema.singular %>_params) do
{:ok, _} ->
conn
- |> put_flash(:info, "Password reset successfully.")
+ |> put_flash(:success, "Password reset successfully.")
|> redirect(to: ~p"<%= schema.route_prefix %>/log_in")
{:error, changeset} ->
diff --git a/priv/templates/phx.gen.auth/reset_password_controller_test.exs b/priv/templates/phx.gen.auth/reset_password_controller_test.exs
index f622b51e01..372e27c89e 100644
--- a/priv/templates/phx.gen.auth/reset_password_controller_test.exs
+++ b/priv/templates/phx.gen.auth/reset_password_controller_test.exs
@@ -94,7 +94,7 @@ defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web
assert redirected_to(conn) == ~p"<%= schema.route_prefix %>/log_in"
refute get_session(conn, :<%= schema.singular %>_token)
- assert Phoenix.Flash.get(conn.assigns.flash, :info) =~
+ assert Phoenix.Flash.get(conn.assigns.flash, :success) =~
"Password reset successfully"
assert <%= inspect context.alias %>.get_<%= schema.singular %>_by_email_and_password(<%= schema.singular %>.email, "new valid password")
diff --git a/priv/templates/phx.gen.auth/reset_password_live.ex b/priv/templates/phx.gen.auth/reset_password_live.ex
index 32845c9ee2..2c4490d074 100644
--- a/priv/templates/phx.gen.auth/reset_password_live.ex
+++ b/priv/templates/phx.gen.auth/reset_password_live.ex
@@ -60,7 +60,7 @@ defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web
{:ok, _} ->
{:noreply,
socket
- |> put_flash(:info, "Password reset successfully.")
+ |> put_flash(:success, "Password reset successfully.")
|> redirect(to: ~p"<%= schema.route_prefix %>/log_in")}
{:error, changeset} ->
diff --git a/priv/templates/phx.gen.auth/reset_password_live_test.exs b/priv/templates/phx.gen.auth/reset_password_live_test.exs
index 4e4995dd35..f8b330d4cc 100644
--- a/priv/templates/phx.gen.auth/reset_password_live_test.exs
+++ b/priv/templates/phx.gen.auth/reset_password_live_test.exs
@@ -64,7 +64,7 @@ defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web
|> follow_redirect(conn, ~p"<%= schema.route_prefix %>/log_in")
refute get_session(conn, :<%= schema.singular %>_token)
- assert Phoenix.Flash.get(conn.assigns.flash, :info) =~ "Password reset successfully"
+ assert Phoenix.Flash.get(conn.assigns.flash, :success) =~ "Password reset successfully"
assert <%= inspect context.alias %>.get_<%= schema.singular %>_by_email_and_password(<%= schema.singular %>.email, "new valid password")
end
diff --git a/priv/templates/phx.gen.auth/session_controller.ex b/priv/templates/phx.gen.auth/session_controller.ex
index cb76ac3ea9..4779407956 100644
--- a/priv/templates/phx.gen.auth/session_controller.ex
+++ b/priv/templates/phx.gen.auth/session_controller.ex
@@ -5,25 +5,25 @@ defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web
alias <%= inspect auth_module %><%= if live? do %>
def create(conn, %{"_action" => "registered"} = params) do
- create(conn, params, "Account created successfully!")
+ create(conn, params, :success, "Account created successfully!")
end
def create(conn, %{"_action" => "password_updated"} = params) do
conn
|> put_session(:<%= schema.singular %>_return_to, ~p"<%= schema.route_prefix %>/settings")
- |> create(params, "Password updated successfully!")
+ |> create(params, :success, "Password updated successfully!")
end
def create(conn, params) do
- create(conn, params, "Welcome back!")
+ create(conn, params, :info, "Welcome back!")
end
- defp create(conn, %{"<%= schema.singular %>" => <%= schema.singular %>_params}, info) do
+ defp create(conn, %{"<%= schema.singular %>" => <%= schema.singular %>_params}, kind, message) do
%{"email" => email, "password" => password} = <%= schema.singular %>_params
if <%= schema.singular %> = <%= inspect context.alias %>.get_<%= schema.singular %>_by_email_and_password(email, password) do
conn
- |> put_flash(:info, info)
+ |> put_flash(kind, message)
|> <%= inspect schema.alias %>Auth.log_in_<%= schema.singular %>(<%= schema.singular %>, <%= schema.singular %>_params)
else
# In order to prevent user enumeration attacks, don't disclose whether the email is registered.
@@ -53,7 +53,7 @@ defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web
def delete(conn, _params) do
conn
- |> put_flash(:info, "Logged out successfully.")
+ |> put_flash(:success, "Logged out successfully.")
|> <%= inspect schema.alias %>Auth.log_out_<%= schema.singular %>()
end
end
diff --git a/priv/templates/phx.gen.auth/session_controller_test.exs b/priv/templates/phx.gen.auth/session_controller_test.exs
index 70473c2cea..18718a045d 100644
--- a/priv/templates/phx.gen.auth/session_controller_test.exs
+++ b/priv/templates/phx.gen.auth/session_controller_test.exs
@@ -81,7 +81,7 @@ defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web
})
assert redirected_to(conn) == ~p"/"
- assert Phoenix.Flash.get(conn.assigns.flash, :info) =~ "Account created successfully"
+ assert Phoenix.Flash.get(conn.assigns.flash, :success) =~ "Account created successfully"
end
test "login following password update", %{conn: conn, <%= schema.singular %>: <%= schema.singular %>} do
@@ -96,7 +96,7 @@ defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web
})
assert redirected_to(conn) == ~p"<%= schema.route_prefix %>/settings"
- assert Phoenix.Flash.get(conn.assigns.flash, :info) =~ "Password updated successfully"
+ assert Phoenix.Flash.get(conn.assigns.flash, :success) =~ "Password updated successfully"
end
test "redirects to login page with invalid credentials", %{conn: conn} do
@@ -126,14 +126,14 @@ defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web
conn = conn |> log_in_<%= schema.singular %>(<%= schema.singular %>) |> delete(~p"<%= schema.route_prefix %>/log_out")
assert redirected_to(conn) == ~p"/"
refute get_session(conn, :<%= schema.singular %>_token)
- assert Phoenix.Flash.get(conn.assigns.flash, :info) =~ "Logged out successfully"
+ assert Phoenix.Flash.get(conn.assigns.flash, :success) =~ "Logged out successfully"
end
test "succeeds even if the <%= schema.singular %> is not logged in", %{conn: conn} do
conn = delete(conn, ~p"<%= schema.route_prefix %>/log_out")
assert redirected_to(conn) == ~p"/"
refute get_session(conn, :<%= schema.singular %>_token)
- assert Phoenix.Flash.get(conn.assigns.flash, :info) =~ "Logged out successfully"
+ assert Phoenix.Flash.get(conn.assigns.flash, :success) =~ "Logged out successfully"
end
end
end
diff --git a/priv/templates/phx.gen.auth/settings_controller.ex b/priv/templates/phx.gen.auth/settings_controller.ex
index 971c12df00..4552611c75 100644
--- a/priv/templates/phx.gen.auth/settings_controller.ex
+++ b/priv/templates/phx.gen.auth/settings_controller.ex
@@ -41,7 +41,7 @@ defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web
case <%= inspect context.alias %>.update_<%= schema.singular %>_password(<%= schema.singular %>, password, <%= schema.singular %>_params) do
{:ok, <%= schema.singular %>} ->
conn
- |> put_flash(:info, "Password updated successfully.")
+ |> put_flash(:success, "Password updated successfully.")
|> put_session(:<%= schema.singular %>_return_to, ~p"<%= schema.route_prefix %>/settings")
|> <%= inspect schema.alias %>Auth.log_in_<%= schema.singular %>(<%= schema.singular %>)
@@ -54,7 +54,7 @@ defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web
case <%= inspect context.alias %>.update_<%= schema.singular %>_email(conn.assigns.current_<%= schema.singular %>, token) do
:ok ->
conn
- |> put_flash(:info, "Email changed successfully.")
+ |> put_flash(:success, "Email changed successfully.")
|> redirect(to: ~p"<%= schema.route_prefix %>/settings")
:error ->
diff --git a/priv/templates/phx.gen.auth/settings_controller_test.exs b/priv/templates/phx.gen.auth/settings_controller_test.exs
index 7c83ed5544..cbb45bf263 100644
--- a/priv/templates/phx.gen.auth/settings_controller_test.exs
+++ b/priv/templates/phx.gen.auth/settings_controller_test.exs
@@ -36,7 +36,7 @@ defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web
assert get_session(new_password_conn, :<%= schema.singular %>_token) != get_session(conn, :<%= schema.singular %>_token)
- assert Phoenix.Flash.get(new_password_conn.assigns.flash, :info) =~
+ assert Phoenix.Flash.get(new_password_conn.assigns.flash, :success) =~
"Password updated successfully"
assert <%= inspect context.alias %>.get_<%= schema.singular %>_by_email_and_password(<%= schema.singular %>.email, "new valid password")
@@ -112,7 +112,7 @@ defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web
conn = get(conn, ~p"<%= schema.route_prefix %>/settings/confirm_email/#{token}")
assert redirected_to(conn) == ~p"<%= schema.route_prefix %>/settings"
- assert Phoenix.Flash.get(conn.assigns.flash, :info) =~
+ assert Phoenix.Flash.get(conn.assigns.flash, :success) =~
"Email changed successfully"
refute <%= inspect context.alias %>.get_<%= schema.singular %>_by_email(<%= schema.singular %>.email)
diff --git a/priv/templates/phx.gen.auth/settings_live.ex b/priv/templates/phx.gen.auth/settings_live.ex
index b6958f43a7..bfadf9fbb5 100644
--- a/priv/templates/phx.gen.auth/settings_live.ex
+++ b/priv/templates/phx.gen.auth/settings_live.ex
@@ -77,7 +77,7 @@ defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web
socket =
case <%= inspect context.alias %>.update_<%= schema.singular %>_email(socket.assigns.current_<%= schema.singular %>, token) do
:ok ->
- put_flash(socket, :info, "Email changed successfully.")
+ put_flash(socket, :success, "Email changed successfully.")
:error ->
put_flash(socket, :error, "Email change link is invalid or it has expired.")
diff --git a/priv/templates/phx.gen.auth/settings_live_test.exs b/priv/templates/phx.gen.auth/settings_live_test.exs
index e4a25d1f2f..46989c5ecb 100644
--- a/priv/templates/phx.gen.auth/settings_live_test.exs
+++ b/priv/templates/phx.gen.auth/settings_live_test.exs
@@ -112,7 +112,7 @@ defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web
assert get_session(new_password_conn, :<%= schema.singular %>_token) != get_session(conn, :<%= schema.singular %>_token)
- assert Phoenix.Flash.get(new_password_conn.assigns.flash, :info) =~
+ assert Phoenix.Flash.get(new_password_conn.assigns.flash, :success) =~
"Password updated successfully"
assert <%= inspect context.alias %>.get_<%= schema.singular %>_by_email_and_password(<%= schema.singular %>.email, new_password)
@@ -176,7 +176,7 @@ defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web
assert {:live_redirect, %{to: path, flash: flash}} = redirect
assert path == ~p"<%= schema.route_prefix %>/settings"
- assert %{"info" => message} = flash
+ assert %{"success" => message} = flash
assert message == "Email changed successfully."
refute <%= inspect context.alias %>.get_<%= schema.singular %>_by_email(<%= schema.singular %>.email)
assert <%= inspect context.alias %>.get_<%= schema.singular %>_by_email(email)
diff --git a/priv/templates/phx.gen.html/controller.ex b/priv/templates/phx.gen.html/controller.ex
index de3e013ed9..d15e39abf4 100644
--- a/priv/templates/phx.gen.html/controller.ex
+++ b/priv/templates/phx.gen.html/controller.ex
@@ -18,7 +18,7 @@ defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web
case <%= inspect context.alias %>.create_<%= schema.singular %>(<%= schema.singular %>_params) do
{:ok, <%= schema.singular %>} ->
conn
- |> put_flash(:info, "<%= schema.human_singular %> created successfully.")
+ |> put_flash(:success, "<%= schema.human_singular %> created successfully.")
|> redirect(to: ~p"<%= schema.route_prefix %>/#{<%= schema.singular %>}")
{:error, %Ecto.Changeset{} = changeset} ->
@@ -43,7 +43,7 @@ defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web
case <%= inspect context.alias %>.update_<%= schema.singular %>(<%= schema.singular %>, <%= schema.singular %>_params) do
{:ok, <%= schema.singular %>} ->
conn
- |> put_flash(:info, "<%= schema.human_singular %> updated successfully.")
+ |> put_flash(:success, "<%= schema.human_singular %> updated successfully.")
|> redirect(to: ~p"<%= schema.route_prefix %>/#{<%= schema.singular %>}")
{:error, %Ecto.Changeset{} = changeset} ->
@@ -56,7 +56,7 @@ defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web
{:ok, _<%= schema.singular %>} = <%= inspect context.alias %>.delete_<%= schema.singular %>(<%= schema.singular %>)
conn
- |> put_flash(:info, "<%= schema.human_singular %> deleted successfully.")
+ |> put_flash(:success, "<%= schema.human_singular %> deleted successfully.")
|> redirect(to: ~p"<%= schema.route_prefix %>")
end
end
diff --git a/priv/templates/phx.gen.live/core_components.ex b/priv/templates/phx.gen.live/core_components.ex
index 1aa9858b70..60954b7cf0 100644
--- a/priv/templates/phx.gen.live/core_components.ex
+++ b/priv/templates/phx.gen.live/core_components.ex
@@ -30,7 +30,7 @@ defmodule <%= @web_namespace %>.CoreComponents do
attr :id, :string, doc: "the optional id of flash container"
attr :flash, :map, default: %{}, doc: "the map of flash messages to display"
attr :title, :string, default: nil
- attr :kind, :atom, values: [:info, :error], doc: "used for styling and flash lookup"
+ attr :kind, :atom, values: [:info, :success, :error], doc: "used for styling and flash lookup"
attr :rest, :global, doc: "the arbitrary HTML attributes to add to the flash container"
slot :inner_block, doc: "the optional inner block that renders the flash message"
@@ -46,13 +46,15 @@ defmodule <%= @web_namespace %>.CoreComponents do
role="alert"
class={[
"fixed top-2 right-2 mr-2 w-80 sm:w-96 z-50 rounded-lg p-3 ring-1",
- @kind == :info && "bg-emerald-50 text-emerald-800 ring-emerald-500 fill-cyan-900",
+ @kind == :info && "bg-blue-50 text-blue-800 ring-blue-500 fill-blue-900",
+ @kind == :success && "bg-emerald-50 text-emerald-800 ring-emerald-500 fill-emerald-900",
@kind == :error && "bg-rose-50 text-rose-900 shadow-md ring-rose-500 fill-rose-900"
]}
{@rest}
>
<.icon :if={@kind == :info} name="hero-information-circle-mini" class="h-4 w-4" />
+ <.icon :if={@kind == :success} name="hero-information-circle-mini" class="h-4 w-4" />
<.icon :if={@kind == :error} name="hero-exclamation-circle-mini" class="h-4 w-4" />
<%%= @title %>
@@ -77,7 +79,8 @@ defmodule <%= @web_namespace %>.CoreComponents do
def flash_group(assigns) do
~H"""
- <.flash kind={:info} title=<%= maybe_heex_attr_gettext.("Success!", @gettext) %> flash={@flash} />
+ <.flash kind={:info} title=<%= maybe_heex_attr_gettext.("Please note", @gettext) %> flash={@flash} />
+ <.flash kind={:success} title=<%= maybe_heex_attr_gettext.("Success!", @gettext) %> flash={@flash} />
<.flash kind={:error} title=<%= maybe_heex_attr_gettext.("Error!", @gettext) %> flash={@flash} />
<.flash
id="client-error"
diff --git a/priv/templates/phx.gen.live/form.ex b/priv/templates/phx.gen.live/form.ex
index 25627a4e3c..9b23ce85b4 100644
--- a/priv/templates/phx.gen.live/form.ex
+++ b/priv/templates/phx.gen.live/form.ex
@@ -67,7 +67,7 @@ defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web
{:ok, <%= schema.singular %>} ->
{:noreply,
socket
- |> put_flash(:info, "<%= schema.human_singular %> updated successfully")
+ |> put_flash(:success, "<%= schema.human_singular %> updated successfully")
|> push_navigate(to: return_path(socket.assigns.return_to, <%= schema.singular %>))}
{:error, %Ecto.Changeset{} = changeset} ->
@@ -80,7 +80,7 @@ defmodule <%= inspect context.web_module %>.<%= inspect Module.concat(schema.web
{:ok, <%= schema.singular %>} ->
{:noreply,
socket
- |> put_flash(:info, "<%= schema.human_singular %> created successfully")
+ |> put_flash(:success, "<%= schema.human_singular %> created successfully")
|> push_navigate(to: return_path(socket.assigns.return_to, <%= schema.singular %>))}
{:error, %Ecto.Changeset{} = changeset} ->