diff options
| -rw-r--r-- | ihatemoney/templates/layout.html | 10 | ||||
| -rw-r--r-- | ihatemoney/web.py | 15 |
2 files changed, 10 insertions, 15 deletions
diff --git a/ihatemoney/templates/layout.html b/ihatemoney/templates/layout.html index eaf13a6..35d2797 100644 --- a/ihatemoney/templates/layout.html +++ b/ihatemoney/templates/layout.html @@ -125,9 +125,13 @@ </div> <div class="messages"> - {% for message in get_flashed_messages() %} - <div class="flash alert alert-success">{{ message }}</div> - {% endfor %} + {% 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> + {% else %} + <div class="flash alert alert-{{ category }}">{{ message }}</div> + {% endif %} + {% endfor %} </div> {% block footer %} diff --git a/ihatemoney/web.py b/ihatemoney/web.py index b5998c6..18ce0c7 100644 --- a/ihatemoney/web.py +++ b/ihatemoney/web.py @@ -310,19 +310,10 @@ def create_project(): try: current_app.mail.send(msg) except SMTPRecipientsRefused: - msg_compl = "Problem sending mail. " - # TODO: destroy the project and cancel instead? - else: - msg_compl = "" + flash(_("Error while sending reminder email"), category="danger") # redirect the user to the next step (invite) - flash( - _( - "%(msg_compl)sThe project identifier is %(project)s", - msg_compl=msg_compl, - project=project.id, - ) - ) + flash(_("The project identifier is %(project)s", project=project.id)) return redirect(url_for(".list_bills", project_id=project.id)) return render_template("create_project.html", form=form) @@ -395,7 +386,7 @@ def edit_project(): return redirect(url_for("main.list_bills")) except ValueError: - flash(_("Invalid JSON"), category="error") + flash(_("Invalid JSON"), category="danger") # Edit form if edit_form.validate_on_submit(): |
