Add some toasts
This commit is contained in:
parent
84fc1d2d93
commit
934deddec4
10 changed files with 50 additions and 5 deletions
|
|
@ -43,5 +43,8 @@ application.register("sortable", SortableController)
|
|||
import ThemeSwitcherController from "./theme_switcher_controller"
|
||||
application.register("theme-switcher", ThemeSwitcherController)
|
||||
|
||||
import ToastController from "./toast_controller"
|
||||
application.register("toast", ToastController)
|
||||
|
||||
import UnsavedChangesController from "./unsaved_changes_controller"
|
||||
application.register("unsaved-changes", UnsavedChangesController)
|
||||
|
|
|
|||
10
app/javascript/controllers/toast_controller.js
Normal file
10
app/javascript/controllers/toast_controller.js
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import { Controller } from "@hotwired/stimulus"
|
||||
import * as bootstrap from "bootstrap"
|
||||
|
||||
// Connects to data-controller="toast"
|
||||
export default class extends Controller {
|
||||
connect() {
|
||||
const toastBootstrap = bootstrap.Toast.getOrCreateInstance(this.element)
|
||||
toastBootstrap.show()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue