From 2560f2e4f7c20986dbe331c651c891754d20a53d Mon Sep 17 00:00:00 2001 From: Trevor Vallender Date: Fri, 18 Aug 2023 17:35:16 +0100 Subject: [PATCH] Basic flash styling --- app/assets/stylesheets/main.css | 17 +++++++++++++++++ app/controllers/sessions_controller.rb | 2 +- app/views/layouts/application.html.erb | 6 +++--- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/app/assets/stylesheets/main.css b/app/assets/stylesheets/main.css index 63aa0f7..c27f6f4 100644 --- a/app/assets/stylesheets/main.css +++ b/app/assets/stylesheets/main.css @@ -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); +} diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 0f400e3..310209d 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -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 diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 580a39e..7008c6c 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -27,9 +27,9 @@
- <% flash.each do |type, msg| %> -
- <%= "#{type}: #{msg}" %> + <% flash.each do |type, message| %> +
+ <%= message %>
<% end %> <%= yield %>