From 3dd639c8d02677b773935aa982ba0c9f3cc209e5 Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Wed, 23 Jun 2021 17:38:54 +0100 Subject: [PATCH] Refactor flash messages to use a flex row for positioning This works better for narrow widths and needs less custom CSS. --- app/assets/stylesheets/common.scss | 19 -------------- app/views/layouts/_flash.html.erb | 42 +++++++++++++++++------------- 2 files changed, 24 insertions(+), 37 deletions(-) diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index 1ec9e08e0..736125bed 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -1404,25 +1404,6 @@ tr.turn:hover { &.notice { background-color: #CBEEA7; } - - div.message { - display: inline-block; - margin-left: $lineheight / 2; - vertical-align: middle; - - p { - margin-top: $lineheight * 0.5; - margin-bottom: $lineheight * 0.5; - - &:first-child { - margin-top: 0px; - } - - &:last-child { - margin-bottom: 0px; - } - } - } } /* Rules for highlighting fields with rails validation errors */ diff --git a/app/views/layouts/_flash.html.erb b/app/views/layouts/_flash.html.erb index f8a89d6df..f8eabaeb3 100644 --- a/app/views/layouts/_flash.html.erb +++ b/app/views/layouts/_flash.html.erb @@ -1,29 +1,35 @@ <% if flash[:error] %> -
- - " type="image/svg+xml" /> - <%= image_tag("notice.png", :srcset => image_path("notice.svg"), :class => "small_icon", :border => 0) %> - -
<%= render_flash(flash[:error]) %>
+
+
+ + " type="image/svg+xml" /> + <%= image_tag("notice.png", :srcset => image_path("notice.svg")) %> + +
+
<%= render_flash(flash[:error]) %>
<% end %> <% if flash[:warning] %> -
- - " type="image/svg+xml"> - <%= image_tag("notice.png", :srcset => image_path("notice.svg"), :class => "small_icon", :border => 0) %> - -
<%= render_flash(flash[:warning]) %>
+
+
+ + " type="image/svg+xml"> + <%= image_tag("notice.png", :srcset => image_path("notice.svg")) %> + +
+
<%= render_flash(flash[:warning]) %>
<% end %> <% if flash[:notice] %> -
- - " type="image/svg+xml"> - <%= image_tag("notice.png", :srcset => image_path("notice.svg"), :class => "small_icon", :border => 0) %> - -
<%= render_flash(flash[:notice]) %>
+
+
+ + " type="image/svg+xml"> + <%= image_tag("notice.png", :srcset => image_path("notice.svg")) %> + +
+
<%= render_flash(flash[:notice]) %>
<% end %> -- 2.43.2