Skip to content
Snippets Groups Projects
Commit 25562b33 authored by Thomas Schneider's avatar Thomas Schneider
Browse files

Nicer display for flashes; show them on every page

parent 9b2e63fd
No related branches found
No related tags found
1 merge request!4Design
...@@ -297,3 +297,39 @@ main { ...@@ -297,3 +297,39 @@ main {
display: none; display: none;
} }
} }
.flash {
border: 1px solid transparent;
border-radius: 4px;
padding: 0.5rem 1rem;
position: relative;
.flash-background {
opacity: 0.5;
z-index: -1;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
&.flash-error {
border-color: red;
.flash-background {
background-color: red;
}
}
&.flash-message {
border-color: var(--accent2);
.flash-background {
background-color: var(--accent2);
}
}
& > div {
opacity: 1;
}
}
...@@ -20,6 +20,17 @@ ...@@ -20,6 +20,17 @@
{%- endif -%} {%- endif -%}
{%- endmacro -%} {%- endmacro -%}
{%- macro flashes() -%}
{%- with messages = get_flashed_messages(with_categories=true) -%}
{%- for category, m in messages -%}
<div class="flash flash-{{ category }}">
<div>{{ m }}</div>
<div class="flash-background"></div>
</div>
{%- endfor -%}
{%- endwith -%}
{%- endmacro -%}
<!DOCTYPE HTML> <!DOCTYPE HTML>
<html lang="{{ lang|default('de') }}"> <html lang="{{ lang|default('de') }}">
<head> <head>
...@@ -55,6 +66,10 @@ ...@@ -55,6 +66,10 @@
{%- endblock nav -%} {%- endblock nav -%}
<main> <main>
<div class="flashes">
{{ flashes() }}
</div>
{%- block main -%} {%- block main -%}
{%- endblock main -%} {%- endblock main -%}
</main> </main>
......
...@@ -10,18 +10,6 @@ ...@@ -10,18 +10,6 @@
{% block main -%} {% block main -%}
<div class="section-container"> <div class="section-container">
<div class="section">
{%- with messages = get_flashed_messages() -%}
{%- if messages -%}
<ul class="flashes">
{%- for m in messages -%}
<li>{{ m }}</li>
{%- endfor -%}
</ul>
{%- endif -%}
{%- endwith -%}
</div>
<div class="section"> <div class="section">
<form method="post" action=""> <form method="post" action="">
{{ form.csrf_token }} {{ form.csrf_token }}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment