Skip to content
Snippets Groups Projects
Commit 5aa4fcd6 authored by Patrick Jentsch's avatar Patrick Jentsch
Browse files

Add close function for Toasts

parent 3532fdc8
No related branches found
No related tags found
No related merge requests found
......@@ -193,8 +193,13 @@
}
}
{% for message in get_flashed_messages() %}
M.toast({html: '{{ message }}'})
M.toast({"classes": "rounded", "html": '<span>{{ message }}</span><button class="btn-flat toast-action red-text" data-action="close"><i class="material-icons">close</i></button>'});
{% endfor %}
for (toastActionElement of document.querySelectorAll(".toast-action[data-action='close']")) {
toastActionElement.addEventListener("click", function(event) {
M.Toast.getInstance(toastActionElement.parentElement).dismiss();
});
}
</script>
</body>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment