Created
September 27, 2018 06:39
-
-
Save stevepiercy/1fc5ead166048f616b3a51d80cf86c68 to your computer and use it in GitHub Desktop.
Examine all flash message queues, pop them, and display their messages with the correct Twitter Bootstrap alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% macro render_flash(key, cls) %} | |
{% if request.session.peek_flash(key) %} | |
{% for msg in request.session.pop_flash(key) %} | |
<div class="alert alert-{{ cls }} alert-dismissible" role="alert"> | |
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button> | |
{{ msg }} | |
</div> | |
{% endfor %} | |
{% endif %} | |
{% endmacro %} | |
{{ render_flash('', 'info') }} | |
{{ render_flash('info', 'info') }} | |
{{ render_flash('success', 'success') }} | |
{{ render_flash('warning', 'warning') }} | |
{{ render_flash('error', 'danger') }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment