From a8a8a46efa4d674e630e2927d3edf27921b78422 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Thu, 7 Aug 2025 13:49:02 -0400 Subject: [PATCH] Extract flash message into a partial, and wrap in a turbo frame to prepare for turbo responses to set a flash message. --- app/views/layouts/application.html.erb | 8 +------- app/views/layouts/shared/_flash.html.erb | 9 +++++++++ 2 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 app/views/layouts/shared/_flash.html.erb diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index ebd12d36c..1d72a8bb8 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -8,13 +8,7 @@ <%= yield :header %> - <% if notice = flash[:notice] || flash[:alert] %> -
-
- <%= notice %> -
-
- <% end %> + <%= render "layouts/shared/flash" %>
<%= yield %> diff --git a/app/views/layouts/shared/_flash.html.erb b/app/views/layouts/shared/_flash.html.erb new file mode 100644 index 000000000..652e3b130 --- /dev/null +++ b/app/views/layouts/shared/_flash.html.erb @@ -0,0 +1,9 @@ +<%= turbo_frame_tag :flash do %> + <% if notice = flash[:notice] || flash[:alert] %> +
+
+ <%= notice %> +
+
+ <% end %> +<% end %>