mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Notifications work through page-reload / page-redirect
- Uses session storage
This commit is contained in:
parent
b6665ec2a7
commit
e62bf92bd6
@ -5,4 +5,33 @@ function showAlert(target, message, timeout=5000) {
|
||||
$(target).delay(timeout).slideUp(200, function() {
|
||||
$(this).alert(close);
|
||||
});
|
||||
}
|
||||
|
||||
function showCachedAlerts() {
|
||||
|
||||
// Success Message
|
||||
if (sessionStorage.getItem("alert-success")) {
|
||||
showAlert("#alert-success", sessionStorage.getItem("alert-success"));
|
||||
sessionStorage.removeItem("alert-success");
|
||||
}
|
||||
|
||||
// Info Message
|
||||
if (sessionStorage.getItem("alert-info")) {
|
||||
showAlert("#alert-info", sessionStorage.getItem("alert-info"));
|
||||
sessionStorage.removeItem("alert-info");
|
||||
}
|
||||
|
||||
// Warning Message
|
||||
if (sessionStorage.getItem("alert-warning")) {
|
||||
showAlert("#alert-warning", sessionStorage.getItem("alert-warning"));
|
||||
sessionStorage.removeItem("alert-warning");
|
||||
}
|
||||
|
||||
// Danger Message
|
||||
if (sessionStorage.getItem("alert-danger")) {
|
||||
showAlert("#alert-danger", sessionStorage.getItem("alert-danger"));
|
||||
sessionStorage.removeItem("alert-danger");
|
||||
}
|
||||
|
||||
sessionStorage.setItem("alert-danger", 'test');
|
||||
}
|
@ -76,6 +76,8 @@ $(document).ready(function () {
|
||||
|
||||
{% endblock %}
|
||||
|
||||
showCachedAlerts();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
<div class='notification-area'>
|
||||
<div class="alert alert-success alert-dismissable" id="alert-success">
|
||||
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
|
||||
<div class='alert-msg'>Success alert</div>
|
||||
@ -14,3 +15,4 @@
|
||||
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
|
||||
<div class='alert-msg'>Danger alert</div>
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user