mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-05-02 03:02:23 +02:00
Add support for different categories of "flash alerts" (#594)
This commit is contained in:
parent
2f466b19f7
commit
c1b158c728
2 changed files with 9 additions and 9 deletions
|
@ -119,8 +119,12 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="messages">
|
<div class="messages">
|
||||||
{% for message in get_flashed_messages() %}
|
{% for category, message in get_flashed_messages(with_categories=true) %}
|
||||||
|
{% if category == "message" %}{# Default category for flash(msg) #}
|
||||||
<div class="flash alert alert-success">{{ message }}</div>
|
<div class="flash alert alert-success">{{ message }}</div>
|
||||||
|
{% else %}
|
||||||
|
<div class="flash alert alert-{{ category }}">{{ message }}</div>
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -250,14 +250,10 @@ def create_project():
|
||||||
try:
|
try:
|
||||||
current_app.mail.send(msg)
|
current_app.mail.send(msg)
|
||||||
except SMTPRecipientsRefused:
|
except SMTPRecipientsRefused:
|
||||||
msg_compl = 'Problem sending mail. '
|
flash(_("Error while sending reminder email"), category="danger")
|
||||||
# TODO: destroy the project and cancel instead?
|
|
||||||
else:
|
|
||||||
msg_compl = ''
|
|
||||||
|
|
||||||
# redirect the user to the next step (invite)
|
# redirect the user to the next step (invite)
|
||||||
flash(_("%(msg_compl)sThe project identifier is %(project)s",
|
flash(_("The project identifier is %(project)s", project=project.id))
|
||||||
msg_compl=msg_compl, project=project.id))
|
|
||||||
return redirect(url_for(".list_bills", project_id=project.id))
|
return redirect(url_for(".list_bills", project_id=project.id))
|
||||||
|
|
||||||
return render_template("create_project.html", form=form)
|
return render_template("create_project.html", form=form)
|
||||||
|
|
Loading…
Reference in a new issue