Add Stimulus toast controller
This commit is contained in:
parent
b38a048e92
commit
4c0948c6d1
|
@ -0,0 +1,17 @@
|
||||||
|
import { Controller } from '@hotwired/stimulus';
|
||||||
|
import { showNotification } from "utilities/notifications";
|
||||||
|
|
||||||
|
export default class extends Controller<HTMLElement> {
|
||||||
|
static values = {
|
||||||
|
message: String,
|
||||||
|
success: Boolean
|
||||||
|
};
|
||||||
|
|
||||||
|
declare readonly messageValue: string;
|
||||||
|
declare readonly successValue: boolean;
|
||||||
|
|
||||||
|
connect(): void {
|
||||||
|
showNotification(this.messageValue, this.successValue);
|
||||||
|
this.element.remove();
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,6 +9,7 @@ import ThemeController from "retrospring/controllers/theme_controller";
|
||||||
import CapabilitiesController from "retrospring/controllers/capabilities_controller";
|
import CapabilitiesController from "retrospring/controllers/capabilities_controller";
|
||||||
import CropperController from "retrospring/controllers/cropper_controller";
|
import CropperController from "retrospring/controllers/cropper_controller";
|
||||||
import InboxSharingController from "retrospring/controllers/inbox_sharing_controller";
|
import InboxSharingController from "retrospring/controllers/inbox_sharing_controller";
|
||||||
|
import ToastController from "retrospring/controllers/toast_controller";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This module sets up Stimulus and our controllers
|
* This module sets up Stimulus and our controllers
|
||||||
|
@ -29,4 +30,5 @@ export default function (): void {
|
||||||
window['Stimulus'].register('format-popup', FormatPopupController);
|
window['Stimulus'].register('format-popup', FormatPopupController);
|
||||||
window['Stimulus'].register('inbox-sharing', InboxSharingController);
|
window['Stimulus'].register('inbox-sharing', InboxSharingController);
|
||||||
window['Stimulus'].register('theme', ThemeController);
|
window['Stimulus'].register('theme', ThemeController);
|
||||||
|
window['Stimulus'].register('toast', ToastController);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue