From b6665ec2a7853fffbc5ff9b25432ad466397c27e Mon Sep 17 00:00:00 2001 From: Oliver Date: Sun, 29 Apr 2018 23:29:38 +1000 Subject: [PATCH] Added dismissable notifications - Bootstrap alert - Can close manually - Also set to disappear after configurable time --- InvenTree/static/script/notification.js | 8 ++++++++ InvenTree/templates/base.html | 2 ++ InvenTree/templates/notification.html | 16 ++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 InvenTree/static/script/notification.js create mode 100644 InvenTree/templates/notification.html diff --git a/InvenTree/static/script/notification.js b/InvenTree/static/script/notification.js new file mode 100644 index 0000000000..58f1bfa3a1 --- /dev/null +++ b/InvenTree/static/script/notification.js @@ -0,0 +1,8 @@ +function showAlert(target, message, timeout=5000) { + + $(target).find(".alert-msg").html(message); + $(target).show(); + $(target).delay(timeout).slideUp(200, function() { + $(this).alert(close); + }); +} \ No newline at end of file diff --git a/InvenTree/templates/base.html b/InvenTree/templates/base.html index 1ba7605ab4..5681010605 100644 --- a/InvenTree/templates/base.html +++ b/InvenTree/templates/base.html @@ -39,6 +39,7 @@ InvenTree {% endblock %} +{% include 'notification.html' %} @@ -48,6 +49,7 @@ InvenTree + {% block js_load %} {% endblock %} diff --git a/InvenTree/templates/notification.html b/InvenTree/templates/notification.html new file mode 100644 index 0000000000..2b91006404 --- /dev/null +++ b/InvenTree/templates/notification.html @@ -0,0 +1,16 @@ +
+ × +
Success alert
+
+
+ × +
Info alert
+
+
+ × +
Warning alert
+
+
+ × +
Danger alert
+