mirror of
https://github.com/moodle/moodle.git
synced 2025-08-10 03:16:42 +02:00
MDL-66828 core: Add toast-style notifications
Part of MDL-66074
This commit is contained in:
parent
b253a4f21d
commit
224ea04e68
15 changed files with 135 additions and 1 deletions
21
lib/templates/local/toast/message.mustache
Normal file
21
lib/templates/local/toast/message.mustache
Normal file
|
@ -0,0 +1,21 @@
|
|||
<div id="toast-{{uniqid}}" class="toast bg-dark text-white rounded mx-auto" data-delay="{{delay}}" {{^autohide}}data-autohide="false"{{/autohide}}>
|
||||
<div class="toast-body">
|
||||
<span>{{{message}}}</span>
|
||||
{{#closeButton}}
|
||||
<button type="button" class="ml-2 mb-1 close text-white" data-dismiss="toast" aria-label="{{#str}}dismissnotification, core{{/str}}">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
{{/closeButton}}
|
||||
</div>
|
||||
</div>
|
||||
{{#js}}
|
||||
require(['jquery', 'theme_boost/toast'], function(jQuery) {
|
||||
// Show the toast.
|
||||
// Bootstrap toast components are not shown automatically.
|
||||
jQuery('#toast-{{uniqid}}').toast('show');
|
||||
|
||||
jQuery('#toast-{{uniqid}}').on('hidden.bs.toast', function(e) {
|
||||
e.target.remove();
|
||||
});
|
||||
});
|
||||
{{/js}}
|
1
lib/templates/local/toast/wrapper.mustache
Normal file
1
lib/templates/local/toast/wrapper.mustache
Normal file
|
@ -0,0 +1 @@
|
|||
<div class="toast-wrapper mx-auto py-3 fixed-top" role="status" aria-live="polite"></div>
|
Loading…
Add table
Add a link
Reference in a new issue