2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-19 05:25:42 +00:00

Improvements for alert notifications

- Dismissable
- Delete after a certain amount of time
This commit is contained in:
Oliver
2021-11-03 17:55:30 +11:00
parent 85adf842f6
commit e7f6268640
6 changed files with 99 additions and 53 deletions

View File

@ -84,6 +84,13 @@
</div>
</div>
<main class='col ps-md-2 pt-2'>
{% block alerts %}
<div class='notification-area' id='alerts'>
<!-- Div for displayed alerts -->
</div>
{% endblock %}
{% block breadcrumb_list %}
<div class='container-fluid navigation'>
<nav aria-label='breadcrumb'>
@ -102,7 +109,6 @@
</div>
{% include 'modals.html' %}
{% include 'about.html' %}
{% include 'notification.html' %}
</div>
<!-- Scripts -->

View File

@ -399,8 +399,18 @@ function toggleStar(options) {
success: function(response) {
if (response.starred) {
$(options.button).removeClass('fa fa-bell-slash').addClass('fas fa-bell icon-green');
$(options.button).attr('title', '{% trans "You are subscribed to notifications for this part" %}');
showMessage('{% trans "You have subscribed to notifications for this part" %}', {
style: 'success',
});
} else {
$(options.button).removeClass('fas fa-bell icon-green').addClass('fa fa-bell-slash');
$(options.button).attr('title', '{% trans "Subscribe to notifications for this part" %}');
showMessage('{% trans "You have unsubscribed to notifications for this part" %}', {
style: 'warning',
});
}
}
}

View File

@ -1,18 +0,0 @@
<div class='notification-area'>
<div class="alert alert-success alert-dismissable" id="alert-success">
<a href="#" class="close" data-bs-dismiss="alert" aria-label="close">&times;</a>
<div class='alert-msg'>Success alert</div>
</div>
<div class='alert alert-info alert-dismissable' id='alert-info'>
<a href="#" class="close" data-bs-dismiss="alert" aria-label="close">&times;</a>
<div class='alert-msg'>Info alert</div>
</div>
<div class='alert alert-warning alert-dismissable' id='alert-warning'>
<a href="#" class="close" data-bs-dismiss="alert" aria-label="close">&times;</a>
<div class='alert-msg'>Warning alert</div>
</div>
<div class='alert alert-danger alert-dismissable' id='alert-danger'>
<a href="#" class="close" data-bs-dismiss="alert" aria-label="close">&times;</a>
<div class='alert-msg'>Danger alert</div>
</div>
</div>