diff options
author | Marian Sigler <m@qjym.de> | 2012-09-21 15:32:15 +0200 |
---|---|---|
committer | Marian Sigler <m@qjym.de> | 2012-09-21 15:32:15 +0200 |
commit | c6d55f462ebc1d5fb387ccc7873582406205bef8 (patch) | |
tree | 96349dff31b623258612c26a7926fe909306c705 | |
parent | c89a73370e51e0218a6a8b9dbfe34527c002fb22 (diff) | |
download | web-c6d55f462ebc1d5fb387ccc7873582406205bef8.tar.gz web-c6d55f462ebc1d5fb387ccc7873582406205bef8.tar.bz2 web-c6d55f462ebc1d5fb387ccc7873582406205bef8.zip |
add color to flashes
-rw-r--r-- | app.py | 4 | ||||
-rw-r--r-- | static/layout.css | 22 | ||||
-rw-r--r-- | templates/base.html | 8 |
3 files changed, 28 insertions, 6 deletions
@@ -37,7 +37,7 @@ def index(): form = LoginForm(request.form) if request.method == 'POST' and form.validate(): if login_user(form.username.data, form.password.data): - flash(u'Erfolgreich eingeloggt (als %s)' % session['username']) + flash(u'Erfolgreich eingeloggt (als %s)' % session['username'], 'success') return redirect(url_for('settings')) else: flash(u'Ungültiger Benutzername und/oder Passwort', 'error') @@ -124,7 +124,7 @@ def settings(): if changed: g.ldap.update(g.user) - flash(u'%s geändert' % u' und '.join(changed)) + flash(u'%s geändert' % u' und '.join(changed), 'success') return redirect(url_for('settings')) diff --git a/static/layout.css b/static/layout.css index 730d79f..2d7be98 100644 --- a/static/layout.css +++ b/static/layout.css @@ -2,6 +2,28 @@ form .errors { color: #D00; } +ul.flashes { + padding-left: 0; +} +ul.flashes li { + list-style: none; + margin-left: 0; + display: block; + padding: .2em .4em; + + border: 1px solid #ee3; + background-color: #ffd; +} +ul.flashes li.error { + border-color: #e33; + background-color: #fdd; +} +ul.flashes li.success { + border-color: #3e3; + background-color: #dfd; +} + + body { margin: 0 auto; width: 640px; diff --git a/templates/base.html b/templates/base.html index 22c16f0..1873dd3 100644 --- a/templates/base.html +++ b/templates/base.html @@ -25,11 +25,11 @@ <p>Not logged in. <a href="{{ url_for('index') }}">Log in</a></p> {%- endif %} - {% with messages = get_flashed_messages() %} + {% with messages = get_flashed_messages(with_categories=true) %} {% if messages %} - <ul class=flashes> - {% for message in messages %} - <li>{{ message }}</li> + <ul class="flashes"> + {% for category, message in messages %} + <li class="{{ category }}">{{ message }}</li> {% endfor %} </ul> {% endif %} |