mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
clean up typescript initialization
This commit is contained in:
16
netbox/project-static/src/messages.ts
Normal file
16
netbox/project-static/src/messages.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { Toast } from 'bootstrap';
|
||||
|
||||
/**
|
||||
* Find any active messages from django.contrib.messages and show them in a toast.
|
||||
*/
|
||||
export function initMessages(): void {
|
||||
const elements = document.querySelectorAll<HTMLDivElement>(
|
||||
'body > div#django-messages > div.django-message.toast',
|
||||
);
|
||||
for (const element of elements) {
|
||||
if (element !== null) {
|
||||
const toast = new Toast(element);
|
||||
toast.show();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user