Ensure that closing the alert box on the login page will close multiple alert boxes if opened.

This commit is contained in:
Yogesh Jain 2020-07-10 11:49:49 +05:30 committed by Akshay Joshi
parent e8b81db977
commit 92858e40bf

View File

@ -2,7 +2,7 @@
{% if messages %}
<div style="position: fixed; top: 20px; right: 20px; width: 400px; z-index: 9999">
{% for category, message in messages %}
<div class="alert alert-{{ category }} alert-dismissible fade show" role="alert" id="alertbox">
<div class="alert alert-{{ category }} alert-dismissible fade show" role="alert">
{{ message }}
<button onclick="hide()" type="button" class="close" data-dismiss="alert" aria-label="{{ _('Close') }}"><span
aria-hidden="true">&times;</span></button>
@ -11,7 +11,10 @@
</div>
<script>
function hide(){
document.getElementById("alertbox").classList.remove("show");
var target = event.target || event.srcElement;
if (target.type === undefined)
target=target.parentNode;
target.parentNode.classList.remove("show");
}
</script>
{% endif %}