Render messages on base_site.html & add new action message

This commit is contained in:
Santiago L 2022-02-07 14:52:17 +01:00
parent 0d27800948
commit 574ac41239
2 changed files with 13 additions and 2 deletions

View file

@ -1,10 +1,9 @@
import datetime
import flask
from flask import Blueprint, request, url_for
from flask.views import View
from flask_login import current_user, login_required
from ereuse_devicehub import messages
from ereuse_devicehub.inventory.forms import (AllocateForm, LotDeviceForm,
LotForm, NewActionForm,
NewDeviceForm, TagDeviceForm,
@ -303,6 +302,9 @@ class NewActionView(View):
if self.form.validate_on_submit():
self.form.save()
# TODO(@slamora): include details of created action
messages.success('Action created!')
return flask.redirect(next_url)

View file

@ -175,6 +175,15 @@
</aside><!-- End Sidebar-->
<main id="main" class="main">
{% block messages %}
{% for message in session['_messages'] %}
<div class="alert alert-{{ message.level}} alert-dismissible fade show" role="alert">
<i class="bi bi-{{ message.icon }} me-1"></i>
{{ message.content }}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
{% endfor %}
{% endblock %}
{% block main %}
{% endblock main %}