Basic flash styling

This commit is contained in:
Trevor Vallender 2023-08-18 17:35:16 +01:00
parent 942173ebca
commit 2560f2e4f7
3 changed files with 21 additions and 4 deletions

View File

@ -4,6 +4,7 @@
--background-color: #CECECE;
--dark-background-color: #3A3A3A;
--inset-background-color: #FFFFFF;
--alert-border-color: #800000;
}
* {
@ -114,3 +115,19 @@ form {
border-radius: .2em .2em 0 0;
}
}
div.flash {
border: 3px solid;
border-radius: .25em;
margin: 0 auto 1em auto;
max-width: 35em;
padding: .5em;
background-color: var(--dark-background-color);
color: var(--background-color);
}
div.notice {
border-color: var(--highlight-color);
}
div.alert {
border-color: var(--alert-border-color);
}

View File

@ -10,7 +10,7 @@ class SessionsController < ApplicationController
session[:user_id] = @user.id
redirect_to @user, notice: t(".logged_in")
else
redirect_to root_path, notice: t(".login_fail")
redirect_to root_path, alert: t(".login_fail")
end
end

View File

@ -27,9 +27,9 @@
</nav>
</header>
<main>
<% flash.each do |type, msg| %>
<div class="flash">
<%= "#{type}: #{msg}" %>
<% flash.each do |type, message| %>
<div class="flash <%= type %>">
<%= message %>
</div>
<% end %>
<%= yield %>