From 7d1b73ea935e68eda8ae361297e04b27f4ac0a1a Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Tue, 10 Sep 2024 12:13:22 +0300 Subject: [PATCH 1/1] Refactor flash template --- app/views/layouts/_flash.html.erb | 36 ++++++++++--------------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/app/views/layouts/_flash.html.erb b/app/views/layouts/_flash.html.erb index d8adbd0fd..251838bca 100644 --- a/app/views/layouts/_flash.html.erb +++ b/app/views/layouts/_flash.html.erb @@ -1,26 +1,12 @@ -<% if flash[:error] %> -
-
- <%= notice_svg_tag %> -
-
<%= render_flash(flash[:error]) %>
-
-<% end %> - -<% if flash[:warning] %> -
-
- <%= notice_svg_tag %> -
-
<%= render_flash(flash[:warning]) %>
-
-<% end %> - -<% if flash[:notice] %> -
-
- <%= notice_svg_tag %> -
-
<%= render_flash(flash[:notice]) %>
-
+<% [[:error, :danger], [:warning, :warning], [:notice, :success]].each do |flash_type, bootstrap_type| %> + <% if flash[flash_type] %> + <%= tag.div :class => "alert alert-#{bootstrap_type} row mx-0 mb-0 p-3 rounded-0 align-items-center" do %> +
+ <%= notice_svg_tag %> +
+
+ <%= render_flash flash[flash_type] %> +
+ <% end %> + <% end %> <% end %> -- 2.39.5