mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Added dismissable notifications
- Bootstrap alert - Can close manually - Also set to disappear after configurable time
This commit is contained in:
parent
006aa69dbb
commit
b6665ec2a7
8
InvenTree/static/script/notification.js
Normal file
8
InvenTree/static/script/notification.js
Normal file
@ -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);
|
||||
});
|
||||
}
|
@ -39,6 +39,7 @@ InvenTree
|
||||
{% endblock %}
|
||||
</div>
|
||||
|
||||
{% include 'notification.html' %}
|
||||
</div>
|
||||
|
||||
<!-- Scripts -->
|
||||
@ -48,6 +49,7 @@ InvenTree
|
||||
<script type='text/javascript' src="{% static 'script/bootstrap-treeview.js' %}"></script>
|
||||
<script type='text/javascript' src="{% static 'script/trees.js' %}"></script>
|
||||
<script type='text/javascript' src="{% static 'script/sidenav.js' %}"></script>
|
||||
<script type='text/javascript' src="{% static 'script/notification.js' %}"></script>
|
||||
|
||||
{% block js_load %}
|
||||
{% endblock %}
|
||||
|
16
InvenTree/templates/notification.html
Normal file
16
InvenTree/templates/notification.html
Normal file
@ -0,0 +1,16 @@
|
||||
<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>
|
||||
</div>
|
||||
<div class='alert alert-info alert-dismissable' id='alert-info'>
|
||||
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
|
||||
<div class='alert-msg'>Info alert</div>
|
||||
</div>
|
||||
<div class='alert alert-warning alert-dismissable' id='alert-warning'>
|
||||
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
|
||||
<div class='alert-msg'>Warning alert</div>
|
||||
</div>
|
||||
<div class='alert alert-danger alert-dismissable' id='alert-danger'>
|
||||
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
|
||||
<div class='alert-msg'>Danger alert</div>
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user